Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:52

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 //
0027 /// \file TimeStepAction.hh
0028 /// \brief Implementation of the TimeStepAction class
0029 
0030 #include "TimeStepAction.hh"
0031 
0032 #include "G4AnalysisManager.hh"
0033 #include "G4DNAMolecule.hh"
0034 #include "G4Event.hh"
0035 #include "G4EventManager.hh"
0036 #include "G4Molecule.hh"
0037 #include "G4MoleculeTable.hh"
0038 #include "G4OH.hh"
0039 #include "G4SystemOfUnits.hh"
0040 #include "G4UnitsTable.hh"
0041 
0042 #include <G4Scheduler.hh>
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 
0046 TimeStepAction::TimeStepAction() : G4UserTimeStepAction()
0047 {
0048   AddTimeStep(1 * picosecond, 0.35 * picosecond);
0049   AddTimeStep(10 * picosecond, 1 * picosecond);
0050   AddTimeStep(100 * picosecond, 3 * picosecond);
0051   AddTimeStep(1000 * picosecond, 10 * picosecond);
0052   AddTimeStep(10000 * picosecond, 100 * picosecond);
0053 }
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0056 
0057 TimeStepAction::~TimeStepAction() {}
0058 
0059 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0060 
0061 TimeStepAction::TimeStepAction(const TimeStepAction& other) : G4UserTimeStepAction(other) {}
0062 
0063 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0064 
0065 TimeStepAction& TimeStepAction::operator=(const TimeStepAction& rhs)
0066 {
0067   if (this == &rhs) return *this;
0068   return *this;
0069 }
0070 
0071 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0072 
0073 void TimeStepAction::UserReactionAction(const G4Track& trackA, const G4Track& trackB,
0074                                         const std::vector<G4Track*>* pProducts)
0075 {
0076   if (pProducts
0077       && (GetMolecule((*pProducts)[0])->GetDefinition() != G4DamagedDeoxyribose::Definition()))
0078   {
0079     return;
0080   }
0081 
0082   // check for the case "no product"
0083   if (!pProducts) {
0084     return;
0085   }
0086 
0087   auto phyEventId = G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID();
0088 
0089   const G4Track* DNAElement = nullptr;
0090   const G4Track* radical = nullptr;
0091   if (GetMolecule(&trackA)->GetDefinition() == G4Deoxyribose::Definition()) {
0092     DNAElement = &trackA;
0093     radical = &trackB;
0094   }
0095   else {
0096     DNAElement = &trackB;
0097     radical = &trackA;
0098   }
0099 
0100   if (GetMolecule(radical)->GetDefinition() != G4OH::Definition()) {
0101     return;
0102   }
0103 
0104   G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
0105   analysisManager->FillNtupleDColumn(2, 0, DNAElement->GetPosition().getX() / nm);
0106   analysisManager->FillNtupleDColumn(2, 1, DNAElement->GetPosition().getY() / nm);
0107   analysisManager->FillNtupleDColumn(2, 2, DNAElement->GetPosition().getZ() / nm);
0108   analysisManager->FillNtupleSColumn(2, 3, GetMolecule(radical)->GetName());
0109   analysisManager->FillNtupleIColumn(2, 4, G4int(phyEventId));
0110   analysisManager->AddNtupleRow(2);
0111 }