23 #include "G4TrackVector.hh"
24 #include "G4ParticleDefinition.hh"
26 #include "G4Electron.hh"
27 #include "G4Positron.hh"
28 #include "G4OpticalPhoton.hh"
29 #include "G4PionMinus.hh"
30 #include "G4PionPlus.hh"
31 #include "G4OpBoundaryProcess.hh"
32 #include "G4SDManager.hh"
33 #include "G4UnitsTable.hh"
48 G4cout <<
"###### Calling QweakSimSteppingAction::QweakSimSteppingAction() " << G4endl;
62 G4cout <<
"###### Leaving QweakSimSteppingAction::QweakSimSteppingAction() " << G4endl;
69 fSecondary = fpSteppingManager->GetfSecondary();
72 G4Track* theTrack = theStep->GetTrack();
73 G4ParticleDefinition* particleType = theTrack->GetDefinition();
74 G4StepPoint* thePrePoint = theStep->GetPreStepPoint();
75 G4VPhysicalVolume* thePrePV = thePrePoint->GetPhysicalVolume();
76 G4StepPoint* thePostPoint = theStep->GetPostStepPoint();
77 G4VPhysicalVolume* thePostPV = thePostPoint->GetPhysicalVolume();
78 G4TouchableHistory* theTouchable = (G4TouchableHistory*)(thePrePoint->GetTouchable());
80 G4String particleName = theTrack->GetDefinition()->GetParticleName();
81 G4ProcessManager* pm = particleType->GetProcessManager();
84 G4Material* theMaterial = theTrack->GetMaterial();
103 if(theMaterial->GetName()==
"Kryptonite")
105 theTrack->SetTrackStatus(fKillTrackAndSecondaries);
108 G4int parentID = theTrack->GetParentID();
109 if( (particleType==G4Electron::ElectronDefinition()||particleType==G4PionMinus::PionMinusDefinition()||particleType==G4PionPlus::PionPlusDefinition()) && parentID==0 ){
115 G4ThreeVector thePosition = theTrack->GetPosition();
116 G4double theX = thePosition.getX();
117 G4double theY = thePosition.getY();
118 G4double theZ = thePosition.getZ();
122 G4String procName = thePostPoint->GetProcessDefinedStep()->GetProcessName();
124 G4double dEE = thePrePoint->GetKineticEnergy()/MeV-thePostPoint->GetKineticEnergy()/MeV;
138 if ( thePrePV && thePostPV) {
139 if(((thePrePV->GetName()).contains(
"QweakTarget") ||
140 (thePostPV->GetName()).contains(
"QweakTarget"))) {
141 if (procName.compare(
"msc")==0)
143 else if(procName.compare(
"eIoni")==0)
145 else if(procName.compare(
"eBrem")==0)
150 G4double theStepLength = theStep->GetStepLength();
155 if( fabs(theZ -
RandomPositionZ)<=theStepLength && sqrt(theX*theX+theY*theY)<2.54*cm){
157 std::vector< G4double > CrossSection;
158 for (
int i = 0; i<16; i++) { CrossSection.push_back(0.0); }
160 G4double WeightN, Q2, E_out, theta, phi;
162 G4ThreeVector MomentumDirection = theTrack->GetMomentumDirection();
163 G4double E_in = theTrack->GetTotalEnergy()/MeV;
166 myEvent->
GetanEvent(E_in, CrossSection, WeightN, Q2, E_out, MomentumDirection, theta, phi, Asymmetry);
196 if(particleType==G4Electron::ElectronDefinition()){
200 if(particleType==G4PionMinus::PionMinusDefinition()||particleType==G4PionPlus::PionPlusDefinition())
232 theTrack->SetTrackStatus(fStopAndKill);
240 if(!thePostPV || !thePrePV)
return;
243 if(((thePrePV->GetName()).contains(
"QweakTarget") ||
244 (thePostPV->GetName()).contains(
"QweakTarget"))) {
245 if (procName.compare(
"msc")==0)
247 else if(procName.compare(
"eIoni")==0)
249 else if(procName.compare(
"eBrem")==0)
337 if(particleType==G4Electron::ElectronDefinition())
339 G4ThreeVector worldPos = thePrePoint->GetPosition();
340 G4ThreeVector localPos = theTouchable->GetHistory()->GetTopTransform().TransformPoint(worldPos);
344 (!strcmp(thePrePV->GetName(),
"ActiveArea_Physical") ||
345 !strcmp(thePrePV->GetName(),
"CerenkovMasterContainer_Physical")))
357 G4OpBoundaryProcessStatus boundaryStatus=Undefined;
358 static G4OpBoundaryProcess* boundary=NULL;
363 G4int nprocesses = pm->GetProcessListLength();
364 G4ProcessVector* pv = pm->GetProcessList();
365 for(G4int i=0;i<nprocesses;i++){
366 if((*pv)[i]->GetProcessName()==
"OpBoundary"){
367 boundary = (G4OpBoundaryProcess*)(*pv)[i];
377 if(particleType==G4OpticalPhoton::OpticalPhotonDefinition()){
378 boundaryStatus=boundary->GetStatus();
379 if(thePostPoint->GetStepStatus()==fGeomBoundary){
380 switch(boundaryStatus){
389 G4SDManager* SDman = G4SDManager::GetSDMpointer();
390 if(strcmp(thePostPV->GetName(),
"PMTOnlyCathode_Physical") == 0) {
392 G4String pmtonlSDName=
"PMTOnly_PMTSD";
397 theTrack->SetTrackStatus(fStopAndKill);
401 G4String CerenkovSDName=
"/CerenkovPMTSD";
406 theTrack->SetTrackStatus(fStopAndKill);
411 case FresnelReflection:
416 case TotalInternalReflection:
421 case SpikeReflection:
462 if ( theStep->GetTrack()->GetCurrentStepNumber() > 100000 )
463 theStep->GetTrack()->SetTrackStatus(fStopAndKill);
480 return (*fSecondary).size();
494 return (*
fSecondary)[idx]->GetDefinition()->GetParticleName();
508 return (*
fSecondary)[idx]->GetKineticEnergy();
543 return (*
fSecondary)[idx]->GetMomentumDirection();
549 return (*
fSecondary)[idx]->GetCreatorProcess()->GetProcessName();
void GetanEvent(G4double E_in, std::vector< G4double > &CrossSection, G4double &weight_n, G4double &Q2, G4double &E_out, G4ThreeVector &MomentumDirection, G4double &theta, G4double &phi, G4double &Asymmetry)
void StoreOriginVertexPositionZ(G4double vz)
void StoreCrossSectionRadQEIntOnly(G4double cs)
G4String GetSecondaryCreatorProcessName(G4int idx)
G4double TargetCenterPositionZ
G4String GetStoredStepVolumeName()
void StoreCrossSectionWeight(G4double csw)
void StoreOriginVertexPositionY(G4double vy)
void UserSteppingAction(const G4Step *)
G4ThreeVector GetSecondaryParticleMomentum(G4int idx)
G4double targetCenterPositionZ
void StorePDGcode(G4int code)
void AddTodEIonOut(G4double dE)
G4int GetPrimaryEventNumber() const
void StoreOriginVertexMomentumDirectionZ(G4double vz)
void StoreTrackID(G4int tid)
void AddTodEIonIn(G4double dE)
void StoreOriginVertexMomentumDirectionY(G4double vy)
void StoreOriginVertexPositionX(G4double vx)
void StoreStepVolumeName(G4String name)
void StoreOriginVertexKineticEnergy(G4double ekin)
void StoreCrossSectionRadTotal(G4double cs)
void StoreCrossSectionBornInelastic(G4double cs)
void StoreCrossSectionRadQE(G4double cs)
G4double GetOriginVertexPositionZ() const
G4double GetSecondaryParticleTotalEnergy(G4int idx)
void StoreReactionType(G4int rt)
void AddTodEBremIn(G4double dE)
G4String GetSecondaryParticleName(G4int idx)
QweakSimEPEvent * myEvent
void AddTodEMscIn(G4double dE)
void StoreCrossSectionRadElastic(G4double cs)
G4int GetTrackVectorSize()
void StoreOriginVertexMomentumDirectionX(G4double vx)
void AddTodEMscOut(G4double dE)
void StoreOriginVertexPhiAngle(G4double phi)
void StoreLocalCerenkovExitPosition(G4ThreeVector ep)
QweakSimSteppingAction(QweakSimUserInformation *myUInfo, QweakSimEPEvent *myEPEvent)
void StoreOriginVertexThetaAngle(G4double theta)
G4TrackVector * fSecondary
void StorePreScatteringKineticEnergy(G4double ekin)
G4ParticleDefinition * GetSecondaryParticleDefinition(G4int idx)
void StoreCrossSectionRadElasticIntOnly(G4double cs)
void StoreCrossSectionRadElasticPeak(G4double cs)
void StoreCrossSectionRadDISIntOnly(G4double cs)
G4int GetTrackVectorStartIndex()
G4double GetSecondaryParticleXOrigin(G4int idx)
void StoreCrossSectionBornQE(G4double cs)
G4bool ProcessHits_constStep(const G4Step *aStep, G4TouchableHistory *ROhist)
void StorePrimaryQ2(G4double pq2)
G4double GetSecondaryParticleYOrigin(G4int idx)
QweakSimUserInformation * myUserInfo
void StoreCrossSectionBornTotal(G4double cs)
G4double GetSecondaryParticleKineticEnergy(G4int idx)
G4ThreeVector GetSecondaryParticleOrigin(G4int idx)
G4double GetSecondaryParticleZOrigin(G4int idx)
void StoreCrossSectionRadTotalIntOnly(G4double cs)
void StoreGlobalTime(G4double gtime)
void StoreAsymmetry(G4double asym)
void StoreCrossSectionRadDIS(G4double cs)
void StoreOriginVertexTotalEnergy(G4double etot)
G4bool ProcessHits_constStep(const G4Step *, G4TouchableHistory *)
void StoreCrossSection(G4double cs)
void AddTodEBremOut(G4double dE)
G4int GetTotalNumOfSecondaries()