File indexing completed on 2026-05-30 08:07:51
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 "DriftChamberHit.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 namespace B5
0043 {
0044
0045
0046
0047 G4ThreadLocal G4Allocator<DriftChamberHit>* DriftChamberHitAllocator;
0048
0049
0050
0051 DriftChamberHit::DriftChamberHit(G4int layerID) : fLayerID(layerID) {}
0052
0053
0054
0055 G4bool DriftChamberHit::operator==(const DriftChamberHit& ) const
0056 {
0057 return false;
0058 }
0059
0060
0061
0062 void DriftChamberHit::Draw()
0063 {
0064 auto visManager = G4VVisManager::GetConcreteInstance();
0065 if (!visManager) return;
0066
0067 G4Circle circle(fWorldPos);
0068 circle.SetScreenSize(2);
0069 circle.SetFillStyle(G4Circle::filled);
0070 G4VisAttributes attribs(G4Colour::Yellow());
0071 circle.SetVisAttributes(attribs);
0072 visManager->Draw(circle);
0073 }
0074
0075
0076
0077 const std::map<G4String, G4AttDef>* DriftChamberHit::GetAttDefs() const
0078 {
0079 G4bool isNew;
0080 auto store = G4AttDefStore::GetInstance("DriftChamberHit", isNew);
0081
0082 if (isNew) {
0083 (*store)["HitType"] = G4AttDef("HitType", "Hit Type", "Physics", "", "G4String");
0084
0085 (*store)["ID"] = G4AttDef("ID", "ID", "Physics", "", "G4int");
0086
0087 (*store)["Time"] = G4AttDef("Time", "Time", "Physics", "G4BestUnit", "G4double");
0088
0089 (*store)["Pos"] = G4AttDef("Pos", "Position", "Physics", "G4BestUnit", "G4ThreeVector");
0090 }
0091
0092 return store;
0093 }
0094
0095
0096
0097 std::vector<G4AttValue>* DriftChamberHit::CreateAttValues() const
0098 {
0099 auto values = new std::vector<G4AttValue>;
0100
0101 values->push_back(G4AttValue("HitType", "DriftChamberHit", ""));
0102 values->push_back(G4AttValue("ID", G4UIcommand::ConvertToString(fLayerID), ""));
0103 values->push_back(G4AttValue("Time", G4BestUnit(fTime, "Time"), ""));
0104 values->push_back(G4AttValue("Pos", G4BestUnit(fWorldPos, "Length"), ""));
0105
0106 return values;
0107 }
0108
0109
0110
0111 void DriftChamberHit::Print()
0112 {
0113 G4cout << " Layer[" << fLayerID << "] : time " << fTime / ns << " (nsec) --- local (x,y) "
0114 << fLocalPos.x() << ", " << fLocalPos.y() << G4endl;
0115 }
0116
0117
0118
0119 }