File indexing completed on 2026-04-17 07:52:14
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
0032
0033 #include "SensitiveDetectorHit.hh"
0034
0035 #include "G4ios.hh"
0036 #include "G4VVisManager.hh"
0037 #include "G4Circle.hh"
0038 #include "G4Colour.hh"
0039 #include "G4AttDefStore.hh"
0040 #include "G4AttDef.hh"
0041 #include "G4AttValue.hh"
0042 #include "G4UIcommand.hh"
0043 #include "G4UnitsTable.hh"
0044 #include "G4VisAttributes.hh"
0045 #include "G4LogicalVolume.hh"
0046 #include "G4SystemOfUnits.hh"
0047
0048
0049
0050 G4ThreadLocal G4Allocator<SensitiveDetectorHit>* SensitiveDetectorHitAllocator = nullptr;
0051
0052
0053
0054 int SensitiveDetectorHit::operator==(const SensitiveDetectorHit &) const
0055 {
0056 return 0;
0057 }
0058
0059
0060
0061 void SensitiveDetectorHit::Draw()
0062 {
0063 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
0064 if (pVVisManager){
0065 G4Circle circle(fPos);
0066 circle.SetScreenSize(2);
0067 circle.SetFillStyle(G4Circle::filled);
0068 G4Colour colour(1.,1.,0.);
0069 G4VisAttributes attribs(colour);
0070 circle.SetVisAttributes(attribs);
0071 pVVisManager->Draw(circle);
0072 }
0073 }
0074
0075
0076
0077 const std::map<G4String,G4AttDef>* SensitiveDetectorHit::GetAttDefs() const
0078 {
0079 G4bool isNew;
0080 std::map<G4String,G4AttDef>* store =
0081 G4AttDefStore::GetInstance("SensitiveDetectorHit",isNew);
0082
0083 if (isNew) {
0084 G4String ID("ID");
0085 (*store)[ID] = G4AttDef(ID,"ID","Physics","","G4int");
0086
0087 G4String IDP("IDP");
0088 (*store)[IDP] = G4AttDef(IDP,"IDP","Physics","","G4int");
0089
0090 G4String Time("t");
0091 (*store)[Time] = G4AttDef(Time,"Time","Physics","G4BestUnit","G4double");
0092
0093 G4String Pos("pos");
0094 (*store)[Pos] = G4AttDef(Pos, "Position","Physics","G4BestUnit","G4ThreeVector");
0095
0096 G4String Mom("mom");
0097 (*store)[Mom] = G4AttDef(Mom, "Momentum","Physics","G4BestUnit","G4ThreeVector");
0098
0099 G4String En("en");
0100 (*store)[En] = G4AttDef(En, "Energy","Physics","G4BestUnit","G4double");
0101 }
0102
0103 return store;
0104 }
0105
0106
0107
0108 std::vector<G4AttValue>* SensitiveDetectorHit::CreateAttValues() const
0109 {
0110 std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
0111
0112 values->push_back(G4AttValue("ID",G4UIcommand::ConvertToString(fTrackID),""));
0113
0114 values->push_back(G4AttValue("IDP",G4UIcommand::ConvertToString(fTrackIDP),""));
0115
0116 values->push_back(G4AttValue("t",G4BestUnit(fTime,"Time"),""));
0117
0118 values->push_back(G4AttValue("pos",G4BestUnit(fPos,"Length"),""));
0119
0120 values->push_back(G4AttValue("mom",G4BestUnit(fMom,"Energy"),""));
0121
0122 values->push_back(G4AttValue("en",G4BestUnit(fEnergy,"Energy"),""));
0123
0124 values->push_back(G4AttValue("type","",""));
0125
0126 return values;
0127 }
0128
0129
0130
0131 void SensitiveDetectorHit::Print()
0132 {
0133 G4cout << " Hit at time " << fTime/ns
0134 << " (nsec) - pos(x,y,z) " << fPos/mm
0135 << " (mm) - mom(x,y,z) " << fMom/eV << " eV" << G4endl;
0136 }
0137
0138
0139