File indexing completed on 2025-02-23 09:21:11
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 #include "SensitiveDetectorHit.hh"
0028
0029 #include "G4AttDef.hh"
0030 #include "G4AttDefStore.hh"
0031 #include "G4AttValue.hh"
0032 #include "G4Circle.hh"
0033 #include "G4Colour.hh"
0034 #include "G4LogicalVolume.hh"
0035 #include "G4SystemOfUnits.hh"
0036 #include "G4UIcommand.hh"
0037 #include "G4UnitsTable.hh"
0038 #include "G4VVisManager.hh"
0039 #include "G4VisAttributes.hh"
0040 #include "G4ios.hh"
0041
0042 #ifdef G4MULTITHREADED
0043 G4ThreadLocal G4Allocator<SensitiveDetectorHit>* SensitiveDetectorHitAllocator = 0;
0044 #else
0045 G4Allocator<SensitiveDetectorHit> SensitiveDetectorHitAllocator;
0046 #endif
0047
0048
0049
0050 SensitiveDetectorHit::SensitiveDetectorHit()
0051 {
0052 fLayerID = -1;
0053 }
0054
0055
0056
0057 SensitiveDetectorHit::SensitiveDetectorHit(G4int z)
0058 {
0059 fLayerID = z;
0060 }
0061
0062
0063
0064 SensitiveDetectorHit::~SensitiveDetectorHit() {}
0065
0066
0067
0068 SensitiveDetectorHit::SensitiveDetectorHit(const SensitiveDetectorHit& right) : G4VHit()
0069 {
0070 fLayerID = right.fLayerID;
0071 fWorldPos = right.fWorldPos;
0072 }
0073
0074
0075
0076 const SensitiveDetectorHit& SensitiveDetectorHit::operator=(const SensitiveDetectorHit& right)
0077 {
0078 fLayerID = right.fLayerID;
0079 fWorldPos = right.fWorldPos;
0080 return *this;
0081 }
0082
0083
0084
0085 G4bool SensitiveDetectorHit::operator==(const SensitiveDetectorHit& ) const
0086 {
0087 return false;
0088 }
0089
0090
0091
0092 void SensitiveDetectorHit::Draw()
0093 {
0094 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
0095 if (pVVisManager) {
0096 G4Circle circle(fWorldPos);
0097 circle.SetScreenSize(2);
0098 circle.SetFillStyle(G4Circle::filled);
0099 G4Colour colour(1., 1., 0.);
0100 G4VisAttributes attribs(colour);
0101 circle.SetVisAttributes(attribs);
0102 pVVisManager->Draw(circle);
0103 }
0104 }
0105
0106
0107
0108 const std::map<G4String, G4AttDef>* SensitiveDetectorHit::GetAttDefs() const
0109 {
0110 G4bool isNew;
0111 std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("SensitiveDetectorHit", isNew);
0112 if (isNew) {
0113 G4String ID("ID");
0114 (*store)[ID] = G4AttDef(ID, "ID", "Physics", "", "G4int");
0115
0116 G4String Pos("Pos");
0117 (*store)[Pos] = G4AttDef(Pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
0118 }
0119 return store;
0120 }
0121
0122
0123
0124 std::vector<G4AttValue>* SensitiveDetectorHit::CreateAttValues() const
0125 {
0126 std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
0127
0128 values->push_back(G4AttValue("ID", G4UIcommand::ConvertToString(fLayerID), ""));
0129
0130 values->push_back(G4AttValue("Pos", G4BestUnit(fWorldPos, "Length"), ""));
0131
0132 return values;
0133 }
0134
0135
0136
0137 void SensitiveDetectorHit::Print()
0138 {
0139 G4cout << fLayerID << "," << fWorldPos.x() << "," << fWorldPos.z() << "," << fWorldPos.y()
0140 << G4endl;
0141 }
0142
0143