Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:08:42

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 XAluminumElectrodeHit.cc
0027 /// \brief Implementation of the XAluminumElectrodeHit class
0028 
0029 // 20141008  Allocators must be thread-local, and must be pointers
0030 
0031 #include "XAluminumElectrodeHit.hh"
0032 
0033 #include "G4AttDef.hh"
0034 #include "G4AttDefStore.hh"
0035 #include "G4AttValue.hh"
0036 #include "G4Circle.hh"
0037 #include "G4Colour.hh"
0038 #include "G4LogicalVolume.hh"
0039 #include "G4RotationMatrix.hh"
0040 #include "G4SystemOfUnits.hh"
0041 #include "G4Transform3D.hh"
0042 #include "G4UnitsTable.hh"
0043 #include "G4VVisManager.hh"
0044 #include "G4VisAttributes.hh"
0045 #include "G4ios.hh"
0046 
0047 G4ThreadLocal G4Allocator<XAluminumElectrodeHit>* XAluminumElectrodeHitAllocator = 0;
0048 
0049 XAluminumElectrodeHit::XAluminumElectrodeHit()
0050 {
0051   fTime = 0.;
0052   fEdep = 0.;
0053 }
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0056 
0057 XAluminumElectrodeHit::~XAluminumElectrodeHit()
0058 {
0059   ;
0060 }
0061 
0062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0063 
0064 XAluminumElectrodeHit::XAluminumElectrodeHit(const XAluminumElectrodeHit& right) : G4VHit()
0065 {
0066   fTime = right.fTime;
0067   fEdep = right.fEdep;
0068   fWorldPos = right.fWorldPos;
0069   fLocalPos = right.fLocalPos;
0070 }
0071 
0072 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0073 
0074 const XAluminumElectrodeHit& XAluminumElectrodeHit::operator=(const XAluminumElectrodeHit& right)
0075 {
0076   fTime = right.fTime;
0077   fEdep = right.fEdep;
0078   fWorldPos = right.fWorldPos;
0079   fLocalPos = right.fLocalPos;
0080   return *this;
0081 }
0082 
0083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0084 
0085 G4bool XAluminumElectrodeHit::operator==(const XAluminumElectrodeHit& /*right*/) const
0086 {
0087   return false;
0088 }
0089 
0090 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0091 
0092 void XAluminumElectrodeHit::Draw()
0093 {
0094   G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
0095   if (pVVisManager) {
0096     G4Circle circle(fWorldPos);
0097     circle.SetScreenSize(15);
0098     circle.SetFillStyle(G4Circle::filled);
0099     G4Colour colour(0.65, 0.65, 0.);
0100     G4VisAttributes attribs(colour);
0101     attribs.SetStartTime(fTime);
0102     attribs.SetEndTime(fTime + 1 * ms);
0103     circle.SetVisAttributes(attribs);
0104     pVVisManager->Draw(circle);
0105   }
0106 }
0107 
0108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0109 
0110 const std::map<G4String, G4AttDef>* XAluminumElectrodeHit::GetAttDefs() const
0111 {
0112   G4bool isNew;
0113   std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("XAluminumElectrodeHit", isNew);
0114   if (isNew) {
0115     G4String HitType("HitType");
0116     (*store)[HitType] = G4AttDef(HitType, "Hit Type", "Physics", "", "G4String");
0117 
0118     G4String Time("Time");
0119     (*store)[Time] = G4AttDef(Time, "Time", "Physics", "G4BestUnit", "G4double");
0120 
0121     G4String EDep("EDep");
0122     (*store)[EDep] = G4AttDef(Time, "EDep", "Physics", "G4BestUnit", "G4double");
0123 
0124     G4String Pos("Pos");
0125     (*store)[Pos] = G4AttDef(Pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
0126   }
0127   return store;
0128 }
0129 
0130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0131 
0132 std::vector<G4AttValue>* XAluminumElectrodeHit::CreateAttValues() const
0133 {
0134   std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
0135 
0136   values->push_back(G4AttValue("HitType", "XAluminumElectrodeHit", ""));
0137 
0138   values->push_back(G4AttValue("Time", G4BestUnit(fTime, "Time"), ""));
0139 
0140   values->push_back(G4AttValue("EDep", G4BestUnit(fEdep, "Energy"), ""));
0141 
0142   values->push_back(G4AttValue("Pos", G4BestUnit(fWorldPos, "Length"), ""));
0143 
0144   return values;
0145 }
0146 
0147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0148 
0149 void XAluminumElectrodeHit::Print()
0150 {
0151   G4cout << "  time " << fTime / ns << " (nsec) : at " << fLocalPos << "  -- fEdep = " << fEdep / eV
0152          << " [eV]" << G4endl;
0153 }