Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
FCALSteppingAction Class Reference

#include <FCALSteppingAction.hh>

Inheritance diagram for FCALSteppingAction:
G4UserSteppingAction

Public Member Functions

 FCALSteppingAction ()
 
virtual ~FCALSteppingAction ()
 
virtual void UserSteppingAction (const G4Step *)
 
void initialize (G4int)
 
G4double GetOutOfWorldTracks (G4int, G4int)
 
G4double GetSecondaries (G4int, G4int)
 
G4double GetEdepFCAL (G4String)
 
- Public Member Functions inherited from G4UserSteppingAction
 G4UserSteppingAction ()
 
virtual ~G4UserSteppingAction ()
 
void SetSteppingManagerPointer (G4SteppingManager *pValue)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserSteppingAction
G4SteppingManagerfpSteppingManager
 

Detailed Description

Definition at line 42 of file FCALSteppingAction.hh.

Constructor & Destructor Documentation

FCALSteppingAction::FCALSteppingAction ( )

Definition at line 57 of file FCALSteppingAction.cc.

57  :IDold(-1),IDout(-1)
58 {;}
FCALSteppingAction::~FCALSteppingAction ( )
virtual

Definition at line 62 of file FCALSteppingAction.cc.

63 {;}

Member Function Documentation

G4double FCALSteppingAction::GetEdepFCAL ( G4String  FCAL)

Definition at line 239 of file FCALSteppingAction.cc.

Referenced by FCALTBEventAction::EndOfEventAction().

239  {
240  if(strcmp(FCAL,"FCALEm") == 0) {
241  return EdepFCALEm;
242  } else {
243  if(strcmp(FCAL,"FCALHad") == 0) {
244  return EdepFCALHad;}
245  }
246  return 0.0;
247 }
G4double FCALSteppingAction::GetOutOfWorldTracks ( G4int  i,
G4int  j 
)

Definition at line 231 of file FCALSteppingAction.cc.

Referenced by FCALTBEventAction::EndOfEventAction().

231  {
232  return OutOfWorldTracksData[i][j];
233 }
G4double FCALSteppingAction::GetSecondaries ( G4int  i,
G4int  j 
)

Definition at line 235 of file FCALSteppingAction.cc.

Referenced by FCALTBEventAction::EndOfEventAction().

235  {
236  return Secondaries[i][j];
237 }
void FCALSteppingAction::initialize ( G4int  Nev)

Definition at line 215 of file FCALSteppingAction.cc.

Referenced by FCALTBEventAction::BeginOfEventAction().

215  {
216  EventNo = Nev;
217  NTracks = 0;
218  NSecondaries = 0;
219  EdepFCALEm = EdepFCALHad = 0.;
220 
221  for(G4int i=0; i<6000; i++)
222  {
223  for(G4int j=0; j<11; j++)
224  {
225  OutOfWorldTracksData[i][j] = 0.;
226  Secondaries[i][j] = 0.;
227  }
228  };
229 }
int G4int
Definition: G4Types.hh:78
void FCALSteppingAction::UserSteppingAction ( const G4Step astep)
virtual

Reimplemented from G4UserSteppingAction.

Definition at line 67 of file FCALSteppingAction.cc.

References python.hepunit::cm, CLHEP::Hep3Vector::cross(), G4cout, G4endl, G4Track::GetCurrentStepNumber(), G4Track::GetDefinition(), G4Track::GetDynamicParticle(), G4DynamicParticle::GetKineticEnergy(), G4Track::GetMaterial(), G4DynamicParticle::GetMomentum(), G4VPhysicalVolume::GetName(), G4Material::GetName(), G4Track::GetNextVolume(), G4Track::GetParentID(), G4ParticleDefinition::GetParticleName(), G4ParticleDefinition::GetPDGEncoding(), G4DynamicParticle::GetTotalEnergy(), G4Step::GetTotalEnergyDeposit(), G4DynamicParticle::GetTotalMomentum(), G4Track::GetTouchable(), G4Step::GetTrack(), G4Track::GetTrackID(), G4Track::GetVertexMomentumDirection(), G4Track::GetVertexPosition(), G4TouchableHistory::GetVolume(), CLHEP::Hep3Vector::mag(), python.hepunit::mm, test::x, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), z, and CLHEP::Hep3Vector::z().

68 {
69  // Get Edep
70  G4double Edep = astep->GetTotalEnergyDeposit();
71 
72  // Get Track
73  G4Track* aTrack = astep->GetTrack();
74 
75  // Get Touchable History
76  G4TouchableHistory* theTouchable = (G4TouchableHistory*)(aTrack->GetTouchable());
77 
78  // Energy deposit in FCAL1 and FCAL2
79  if(Edep != 0.)
80  {
81  G4VPhysicalVolume* physVol = theTouchable->GetVolume();
82 
83  if(strcmp(physVol->GetName(),"FCALEmModulePhysical")== 0 ||
84  strcmp(physVol->GetName(),"F1LArGapPhysical") == 0)
85  {
86  EdepFCALEm = EdepFCALEm + Edep;
87  };
88 
89  if( (strcmp(physVol->GetName(), "FCALHadModulePhysical") == 0) ||
90  (strcmp(physVol->GetName(), "CuPlateAPhysical") == 0) ||
91  (strcmp(physVol->GetName(), "CuPlateBPhysical") == 0) ||
92  (strcmp(physVol->GetName(), "WAbsorberPhysical") == 0) ||
93  (strcmp(physVol->GetName(), "F2RodPhysical") == 0) ||
94  (strcmp(physVol->GetName(), "F2LArGapPhysical") == 0) )
95  {
96  EdepFCALHad = EdepFCALHad + Edep;
97  };
98  };
99 
100  // Get Tracks properties
101  G4int TrackID = aTrack->GetTrackID();
102  G4int ParentID = aTrack->GetParentID();
103  // Get Associated particle
104  const G4DynamicParticle * aDynamicParticle = aTrack->GetDynamicParticle();
105  G4ParticleDefinition * aParticle = aTrack->GetDefinition();
106  G4String ParticleName = aParticle->GetParticleName();
107 
108  IDnow = EventNo + 10000*TrackID+ 100000000*ParentID;
109 
110  if(IDnow != IDold)
111  {
112  IDold = IDnow;
113 
114  // Get the primary particle
115  if(TrackID==1 && ParentID==0 && (aTrack->GetCurrentStepNumber()) == 1)
116  {
117  PrimaryVertex = aTrack->GetVertexPosition();
118  PrimaryDirection = aTrack->GetVertexMomentumDirection();
119 
120  NSecondaries = 1;
121  Secondaries[NSecondaries][1] = aParticle->GetPDGEncoding();
122  Secondaries[NSecondaries][2] = PrimaryVertex.x();
123  Secondaries[NSecondaries][3] = PrimaryVertex.y();
124  Secondaries[NSecondaries][4] = PrimaryVertex.z();
125  Secondaries[NSecondaries][5] = (aDynamicParticle->GetMomentum()).x();
126  Secondaries[NSecondaries][6] = (aDynamicParticle->GetMomentum()).y();
127  Secondaries[NSecondaries][7] = (aDynamicParticle->GetMomentum()).z();
128  Secondaries[NSecondaries][8] = aDynamicParticle->GetTotalMomentum();
129  Secondaries[NSecondaries][9] = aDynamicParticle->GetTotalEnergy();
130  Secondaries[NSecondaries][10] = aDynamicParticle->GetKineticEnergy();
131 
132  G4cout << " **** Primary : " << EventNo << G4endl;
133  G4cout << " Vertex : " << PrimaryVertex << G4endl;
134  }
135 
136 
137  // Get secondaries in air close to the primary tracks (DCA < 2.mm)
138  G4double DCACut = 2.*mm;
139  G4String Material = aTrack->GetMaterial()->GetName();
140  G4ThreeVector TrackPos = aTrack->GetVertexPosition();
141 
142  if(TrackID != 1 && ParentID == 1 && (strcmp(Material,"Air")==0) && (TrackPos.z() > 135.*cm))
143  {
144  SecondaryVertex = aTrack->GetVertexPosition();
145  SecondaryDirection = aTrack->GetVertexMomentumDirection();
146 
147  // calculate DCA of secondries to primary particle
148  Distance = PrimaryVertex - SecondaryVertex ;
149  VectorProduct = PrimaryDirection.cross(SecondaryDirection);
150  if(VectorProduct == G4ThreeVector() &&
151  PrimaryDirection != G4ThreeVector() && SecondaryDirection != G4ThreeVector())
152  {
153  G4ThreeVector Temp = Distance.cross(PrimaryDirection);
154  VectorProduct = Temp.cross(PrimaryDirection);
155  };
156 
157 VectorProductMagnitude = VectorProduct.mag();
158  if(VectorProductMagnitude == 0.)
159  {
160  VectorProductNorm = G4ThreeVector();
161  } else {
162  VectorProductNorm = (1./VectorProduct.mag()) * VectorProduct ;
163  };
164  DistOfClosestApproach = Distance * VectorProductNorm ;
165 
166  if(std::abs(DistOfClosestApproach) < DCACut)
167  {
168  NSecondaries++;
169  Secondaries[0][0] = NSecondaries;
170  Secondaries[NSecondaries][1] = aParticle->GetPDGEncoding();
171  Secondaries[NSecondaries][2] = (aTrack->GetVertexPosition()).x();
172  Secondaries[NSecondaries][3] = (aTrack->GetVertexPosition()).y();
173  Secondaries[NSecondaries][4] = (aTrack->GetVertexPosition()).z();
174  Secondaries[NSecondaries][5] =(aDynamicParticle->GetMomentum()).x();
175  Secondaries[NSecondaries][6] = (aDynamicParticle->GetMomentum()).y();
176  Secondaries[NSecondaries][7] = (aDynamicParticle->GetMomentum()).z();
177  Secondaries[NSecondaries][8] = aDynamicParticle->GetTotalMomentum();
178  Secondaries[NSecondaries][9] = aDynamicParticle->GetTotalEnergy();
179  Secondaries[NSecondaries][10] =aDynamicParticle->GetKineticEnergy();
180  };
181  };
182  };
183 
184 
185  // Get the World leaving particle
186  if(aTrack->GetNextVolume() == 0) {
187  if(IDnow != IDout) {
188  IDout = IDnow;
189 
190  NTracks++;
191 
192  OutOfWorldTracksData[0][0] = NTracks;
193 
194  OutOfWorldTracksData[NTracks][1] = aParticle->GetPDGEncoding();
195 
196  OutOfWorldTracksData[NTracks][2] = (aTrack->GetVertexPosition()).x();
197  OutOfWorldTracksData[NTracks][3] = (aTrack->GetVertexPosition()).y();
198  OutOfWorldTracksData[NTracks][4] = (aTrack->GetVertexPosition()).z();
199 
200  OutOfWorldTracksData[NTracks][5] = (aDynamicParticle->GetMomentum()).x();
201  OutOfWorldTracksData[NTracks][6] = (aDynamicParticle->GetMomentum()).y();
202  OutOfWorldTracksData[NTracks][7] = (aDynamicParticle->GetMomentum()).z();
203 
204  OutOfWorldTracksData[NTracks][8] = aDynamicParticle->GetTotalMomentum();
205 
206  OutOfWorldTracksData[NTracks][9] = aDynamicParticle->GetTotalEnergy();
207 
208  OutOfWorldTracksData[NTracks][10] = aDynamicParticle->GetKineticEnergy();
209  };
210  };
211 
212 
213 }
G4ParticleDefinition * GetDefinition() const
G4int GetParentID() const
G4double GetKineticEnergy() const
CLHEP::Hep3Vector G4ThreeVector
G4double GetTotalEnergy() const
G4VPhysicalVolume * GetVolume(G4int depth=0) const
double x() const
const G4DynamicParticle * GetDynamicParticle() const
G4double z
Definition: TRTMaterials.hh:39
const G4String & GetName() const
Definition: G4Material.hh:176
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
double z() const
G4VPhysicalVolume * GetNextVolume() const
G4double GetTotalMomentum() const
G4GLOB_DLL std::ostream G4cout
G4int GetCurrentStepNumber() const
const G4String & GetName() const
G4int GetTrackID() const
const G4ThreeVector & GetVertexPosition() const
G4double GetTotalEnergyDeposit() const
G4Material * GetMaterial() const
const G4VTouchable * GetTouchable() const
double y() const
#define G4endl
Definition: G4ios.hh:61
Hep3Vector cross(const Hep3Vector &) const
double G4double
Definition: G4Types.hh:76
G4Track * GetTrack() const
double mag() const
const G4ThreeVector & GetVertexMomentumDirection() const
G4ThreeVector GetMomentum() const

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