Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-08 08:29:08

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file TimeStepAction.cc
0027 /// \brief Implementation of the TimeStepAction class
0028 
0029 #include "TimeStepAction.hh"
0030 
0031 #include "G4AnalysisManager.hh"
0032 #include "G4DNAMolecule.hh"
0033 #include "G4Event.hh"
0034 #include "G4EventManager.hh"
0035 #include "G4Molecule.hh"
0036 #include "G4MoleculeTable.hh"
0037 #include "G4OH.hh"
0038 #include "G4SystemOfUnits.hh"
0039 #include "G4UnitsTable.hh"
0040 
0041 #include <G4Scheduler.hh>
0042 
0043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0044 
0045 TimeStepAction::TimeStepAction() : G4UserTimeStepAction()
0046 {
0047   AddTimeStep(1 * picosecond, 0.35 * picosecond);
0048   AddTimeStep(10 * picosecond, 1 * picosecond);
0049   AddTimeStep(100 * picosecond, 3 * picosecond);
0050   AddTimeStep(1000 * picosecond, 10 * picosecond);
0051   AddTimeStep(10000 * picosecond, 100 * picosecond);
0052 }
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 
0056 TimeStepAction::TimeStepAction(const TimeStepAction& other) : G4UserTimeStepAction(other) {}
0057 
0058 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0059 
0060 TimeStepAction& TimeStepAction::operator=(const TimeStepAction& rhs)
0061 {
0062   if (this == &rhs) return *this;
0063   return *this;
0064 }
0065 
0066 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0067 
0068 void TimeStepAction::UserReactionAction(const G4Track& trackA, const G4Track& trackB,
0069                                         const std::vector<G4Track*>* pProducts)
0070 {
0071   if (pProducts
0072       && (GetMolecule((*pProducts)[0])->GetDefinition() != G4DamagedDeoxyribose::Definition()))
0073   {
0074     return;
0075   }
0076 
0077   // check for the case "no product"
0078   if (!pProducts) {
0079     return;
0080   }
0081 
0082   auto phyEventId = G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID();
0083 
0084   const G4Track* DNAElement = nullptr;
0085   const G4Track* radical = nullptr;
0086   if (GetMolecule(&trackA)->GetDefinition() == G4Deoxyribose::Definition()) {
0087     DNAElement = &trackA;
0088     radical = &trackB;
0089   }
0090   else {
0091     DNAElement = &trackB;
0092     radical = &trackA;
0093   }
0094 
0095   if (GetMolecule(radical)->GetDefinition() != G4OH::Definition()) {
0096     return;
0097   }
0098 
0099   G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
0100   analysisManager->FillNtupleDColumn(2, 0, DNAElement->GetPosition().getX() / nm);
0101   analysisManager->FillNtupleDColumn(2, 1, DNAElement->GetPosition().getY() / nm);
0102   analysisManager->FillNtupleDColumn(2, 2, DNAElement->GetPosition().getZ() / nm);
0103   analysisManager->FillNtupleSColumn(2, 3, GetMolecule(radical)->GetName());
0104   analysisManager->FillNtupleIColumn(2, 4, G4int(phyEventId));
0105   analysisManager->AddNtupleRow(2);
0106 }