File indexing completed on 2026-06-15 07:54:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include "RE01TrackerHit.hh"
0030
0031 #include "G4AttDef.hh"
0032 #include "G4AttDefStore.hh"
0033 #include "G4AttValue.hh"
0034 #include "G4Circle.hh"
0035 #include "G4Colour.hh"
0036 #include "G4SystemOfUnits.hh"
0037 #include "G4UIcommand.hh"
0038 #include "G4UnitsTable.hh"
0039 #include "G4VVisManager.hh"
0040 #include "G4VisAttributes.hh"
0041
0042 G4ThreadLocal G4Allocator<RE01TrackerHit>* RE01TrackerHitAllocator = 0;
0043
0044
0045 RE01TrackerHit::RE01TrackerHit() : G4VHit(), fEdep(0.0), fPos(0), fTrackID(-1)
0046 {
0047 ;
0048 }
0049
0050
0051 RE01TrackerHit::~RE01TrackerHit()
0052 {
0053 ;
0054 }
0055
0056
0057 void RE01TrackerHit::Draw()
0058 {
0059 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
0060 if (pVVisManager) {
0061 G4Circle circle(fPos);
0062 circle.SetScreenSize(0.04);
0063 circle.SetFillStyle(G4Circle::filled);
0064 G4Colour colour(1., 0., 0.);
0065 G4VisAttributes attribs(colour);
0066 circle.SetVisAttributes(attribs);
0067 pVVisManager->Draw(circle);
0068 }
0069 }
0070
0071
0072 const std::map<G4String, G4AttDef>* RE01TrackerHit::GetAttDefs() const
0073 {
0074 G4bool isNew;
0075 std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("RE01TrackerHit", isNew);
0076 if (isNew) {
0077 G4String hitType("HitType");
0078 (*store)[hitType] = G4AttDef(hitType, "Hit Type", "Physics", "", "G4String");
0079
0080 G4String trackID("TrackID");
0081 (*store)[trackID] = G4AttDef(trackID, "Track ID", "Physics", "", "G4int");
0082
0083 G4String energy("Energy");
0084 (*store)[energy] = G4AttDef(energy, "Energy Deposited", "Physics", "G4BestUnit", "G4double");
0085
0086 G4String eTrack("ETrack");
0087 (*store)[eTrack] =
0088 G4AttDef(eTrack, "Energy Deposited By Track", "Physics", "G4BestUnit", "G4double");
0089
0090 G4String pos("Pos");
0091 (*store)[pos] = G4AttDef(pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
0092 }
0093 return store;
0094 }
0095
0096
0097 std::vector<G4AttValue>* RE01TrackerHit::CreateAttValues() const
0098 {
0099 std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
0100
0101 values->push_back(G4AttValue("HitType", "RE01TrackerHit", ""));
0102
0103 values->push_back(G4AttValue("TrackID", G4UIcommand::ConvertToString(fTrackID), ""));
0104
0105 values->push_back(G4AttValue("Energy", G4BestUnit(fEdep, "Energy"), ""));
0106
0107 G4double noEnergy = 0. * MeV;
0108 values->push_back(G4AttValue("ETrack", G4BestUnit(noEnergy, "Energy"), ""));
0109
0110 values->push_back(G4AttValue("Pos", G4BestUnit(fPos, "Length"), ""));
0111
0112 return values;
0113 }
0114
0115
0116 void RE01TrackerHit::Print()
0117 {
0118 G4cout << "TrackID " << fTrackID << " Position " << fPos << " : " << fEdep / keV
0119 << " [keV]" << G4endl;
0120 }