ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TimeStepAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TimeStepAction.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 //
29 
30 #include "TimeStepAction.hh"
31 #include <G4Scheduler.hh>
32 #include "G4UnitsTable.hh"
33 #include "G4SystemOfUnits.hh"
34 #include "G4Molecule.hh"
35 #include "g4root.hh"
36 #include "G4DNAMolecule.hh"
37 #include "G4MoleculeTable.hh"
38 #include "G4OH.hh"
39 
40 #include "G4Event.hh"
41 #include "G4EventManager.hh"
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
47 {
52  AddTimeStep(10000*picosecond, 100*picosecond);
53 }
54 
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56 
58 {}
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61 
63  : G4UserTimeStepAction(other)
64 {}
65 
66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67 
70 {
71  if (this == &rhs) return *this;
72  return *this;
73 }
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76 
78  const G4Track& trackB,
79  const std::vector<G4Track*>*
80  pProducts)
81 {
82  if(pProducts && (GetMolecule((*pProducts)[0])->
83  GetDefinition() != G4DamagedDeoxyribose::Definition()))
84  {
85  return;
86  }
87 
88  //check for the case "no product"
89  if(!pProducts)
90  {
91  return;
92  }
93 
94  auto phyEventId = G4EventManager::GetEventManager()->
95  GetConstCurrentEvent()->GetEventID();
96 
97  const G4Track* DNAElement = nullptr;
98  const G4Track* radical = nullptr;
99  if(GetMolecule(&trackA)->
100  GetDefinition() == G4Deoxyribose::Definition())
101  {
102  DNAElement = &trackA;
103  radical = &trackB;
104  }
105  else
106  {
107  DNAElement = &trackB;
108  radical = &trackA;
109  }
110 
111  if(GetMolecule(radical)->GetDefinition() != G4OH::Definition())
112  {
113  return;
114  }
115 
116  G4AnalysisManager* analysisManager =
118  analysisManager->FillNtupleDColumn(2, 0,
119  DNAElement->GetPosition().getX()/nm);
120  analysisManager->FillNtupleDColumn(2, 1,
121  DNAElement->GetPosition().getY()/nm);
122  analysisManager->FillNtupleDColumn(2, 2,
123  DNAElement->GetPosition().getZ()/nm);
124  analysisManager->FillNtupleSColumn(2, 3,
125  GetMolecule(radical)->GetName());
126  analysisManager->FillNtupleIColumn(2, 4,
127  G4int(phyEventId));
128  analysisManager->AddNtupleRow(2);
129 }
130