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