ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SteppingAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SteppingAction.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 #include "SteppingAction.hh"
28 #include "g4root.hh"
29 #include "G4SystemOfUnits.hh"
30 #include "G4ITTrackHolder.hh"
31 #include "G4Track.hh"
32 #include <map>
33 #include "globals.hh"
34 #include "G4Molecule.hh"
35 #include "G4Event.hh"
36 #include "G4EventManager.hh"
37 #include "G4DNAElastic.hh"
39 #include "DetectorConstruction.hh"
40 
41 
42 using MapOfDelayedLists =
43 std::map<double, std::map<int, G4TrackList*> >;
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46 
49  , fpDetector(fpDet)
50 {}
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
53 
55 {}
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
58 
60 {
61  SetupFlags(step);
62 
64  {
66  }
67 
69  {
70  return;
71  }
72 
74  const G4VProcess* pProcess = step->GetPostStepPoint()->
75  GetProcessDefinedStep();
76 
77  //get all processes except G4DNAElectronSolvation
78  if((0 > dE) ||
79  (nullptr != dynamic_cast<const G4DNAElectronSolvation*>(pProcess)))
80  {
81  return;
82  }
83 
84  G4double x=step->GetPreStepPoint()->
85  GetPosition().x()/nanometer;
86  G4double y=step->GetPreStepPoint()->
87  GetPosition().y()/nanometer;
88  G4double z=step->GetPreStepPoint()->
89  GetPosition().z()/nanometer;
90 
91  G4double copyNo = G4double (step->GetPreStepPoint()->
92  GetTouchable()->GetVolume()->GetCopyNo() );
93 
94  G4double eventId =
96  GetConstCurrentEvent()->GetEventID());
97 
98  G4AnalysisManager* analysisManager =
100  analysisManager->FillNtupleDColumn(1, 0, x);
101  analysisManager->FillNtupleDColumn(1, 1, y);
102  analysisManager->FillNtupleDColumn(1, 2, z);
103  analysisManager->FillNtupleDColumn(1, 3, dE);
104  analysisManager->FillNtupleDColumn(1, 4, (step->
105  GetPreStepPoint()->GetKineticEnergy()
106  - step->GetPostStepPoint()->GetKineticEnergy())/eV );
107  analysisManager->FillNtupleIColumn(1, 5, G4int(fVolumeType));
108  analysisManager->FillNtupleDColumn(1, 6, copyNo);
109  analysisManager->FillNtupleIColumn(1, 7, eventId);
110  analysisManager->AddNtupleRow(1);
111 
113  GetDelayedLists();
114  for(auto& delayedmap_it : delayList)
115  {
116  for (auto& trackList : delayedmap_it.second)
117  {
118  if (nullptr == trackList.second)
119  {
120  return;
121  }
122  G4TrackList::iterator itt = trackList.second->begin();
123  G4TrackList::iterator endd = trackList.second->end();
124  for(; itt != endd; ++itt)
125  {
126  G4Track* track = *itt;
127  if(track->GetParentID() !=
128  step->GetTrack()->GetTrackID() ||
129  track->GetPosition() !=
130  step->GetPostStepPoint()->GetPosition())
131  {
132  return;
133  }
134 
136  }
137  }
138  }
139 }
140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
141 
143 {
145  GetPhysicalVolume());
146 }
147 
148 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
149 
151  pPhyVolume)
152 {
153  auto it = (fpDetector->GetGeoDataMap()).find(pPhyVolume);
154 
155  if(it == (fpDetector->GetGeoDataMap()).end())
156  {
157  G4ExceptionDescription exceptionDescription;
158  exceptionDescription <<pPhyVolume->GetName()
159  <<" is wrong physical volume";
160  G4Exception("SteppingAction::SetupVolumeFlag()",
161  "SteppingAction01", FatalException,
162  exceptionDescription);
163  }
164 
165  return it->second;
166 }
167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....