1 | #include "ELYSE/TrappVolHit.hh" |
---|
2 | |
---|
3 | //Geant4 |
---|
4 | #include "G4Box.hh" |
---|
5 | #include "G4AttDefStore.hh" |
---|
6 | #include "G4AttDef.hh" |
---|
7 | #include "G4AttValue.hh" |
---|
8 | #include "G4UnitsTable.hh" |
---|
9 | #include "G4VVisManager.hh" |
---|
10 | #include "G4ParticleTypes.hh" |
---|
11 | #include "G4Circle.hh" |
---|
12 | #include "G4VisAttributes.hh" |
---|
13 | #include "G4RotationMatrix.hh" |
---|
14 | |
---|
15 | //std |
---|
16 | #include <sstream> |
---|
17 | #include <iomanip> |
---|
18 | |
---|
19 | |
---|
20 | //JEC 10/1/06 introduce ELYSE |
---|
21 | namespace ELYSE { |
---|
22 | G4Allocator<TrappVolHit> TrappVolHitAllocator; |
---|
23 | } |
---|
24 | |
---|
25 | ELYSE::TrappVolHit::TrappVolHit() : |
---|
26 | time(0.), |
---|
27 | eTot(0.), |
---|
28 | position(), |
---|
29 | trkId(0), |
---|
30 | parentId(0), |
---|
31 | pdg(0), |
---|
32 | edep(0) |
---|
33 | { |
---|
34 | //JEC very preliminary 15/2/07 for visualisation |
---|
35 | virtualSolid = (G4CSGSolid*)(new G4Box("VolHit",0.1*mm,0.1*mm,0.1*mm)); |
---|
36 | }//Ctor |
---|
37 | |
---|
38 | |
---|
39 | //----------------------------------------------------------------------------------------- |
---|
40 | |
---|
41 | ELYSE::TrappVolHit::~TrappVolHit() { |
---|
42 | delete virtualSolid; |
---|
43 | } |
---|
44 | |
---|
45 | //----------------------------------------------------------------------------------------- |
---|
46 | |
---|
47 | const std::map<G4String,G4AttDef>* ELYSE::TrappVolHit::GetAttDefs() const { |
---|
48 | G4bool isNew; |
---|
49 | std::map<G4String,G4AttDef>* store = G4AttDefStore::GetInstance("TrappVolHit",isNew); |
---|
50 | |
---|
51 | if (isNew) { |
---|
52 | |
---|
53 | G4String VSolid("VSolid"); |
---|
54 | (*store)[VSolid] = G4AttDef(VSolid,"Virtual Solid attached to the Hit","Display","","G4VSolid*"); |
---|
55 | |
---|
56 | G4String Position("Position"); |
---|
57 | (*store)[Position] = G4AttDef(Position,"3D Position","Physics","","G4ThreeVector"); |
---|
58 | |
---|
59 | G4String Time("Time"); |
---|
60 | (*store)[Time] = G4AttDef(Time,"Arrival Time","Physics","","G4double"); |
---|
61 | |
---|
62 | G4String TrkID("TrkID"); |
---|
63 | (*store)[TrkID] = G4AttDef(TrkID,"Track Id","Physics","","G4int"); |
---|
64 | |
---|
65 | G4String ParentID("ParentID"); |
---|
66 | (*store)[ParentID] = G4AttDef(ParentID,"Parent Track Id","Physics","","G4int"); |
---|
67 | |
---|
68 | G4String PDG("PDG"); |
---|
69 | (*store)[PDG] = G4AttDef(PDG,"Track PDG Code","Physics","","G4int"); |
---|
70 | |
---|
71 | G4String Etot("Etot"); |
---|
72 | (*store)[Etot] = G4AttDef(Etot,"Track total energy","Physics","","G4double"); |
---|
73 | |
---|
74 | G4String Edep("Edep"); |
---|
75 | (*store)[Edep] = G4AttDef(Edep,"Deposit energy by the track","Physics","","G4double"); |
---|
76 | |
---|
77 | } |
---|
78 | return store; |
---|
79 | }//GetAttDefs |
---|
80 | |
---|
81 | //---------------------------------------------------------------------------------------------------- |
---|
82 | |
---|
83 | std::vector<G4AttValue>* ELYSE::TrappVolHit::CreateAttValues() const { |
---|
84 | |
---|
85 | std::ostringstream s; |
---|
86 | |
---|
87 | std::vector<G4AttValue>* values = new std::vector<G4AttValue>; |
---|
88 | |
---|
89 | s.str(""); |
---|
90 | s << virtualSolid; |
---|
91 | values->push_back(G4AttValue("VSolid",s.str(),"")); |
---|
92 | |
---|
93 | s.str(""); |
---|
94 | s << &position; |
---|
95 | values->push_back(G4AttValue("Position",s.str(),"")); |
---|
96 | |
---|
97 | s.str(""); |
---|
98 | s << time; |
---|
99 | values->push_back(G4AttValue("Time",s.str(),"")); |
---|
100 | |
---|
101 | s.str(""); |
---|
102 | s << trkId; |
---|
103 | values->push_back(G4AttValue("TrkID",s.str(),"")); |
---|
104 | |
---|
105 | s.str(""); |
---|
106 | s << parentId; |
---|
107 | values->push_back(G4AttValue("ParentID",s.str(),"")); |
---|
108 | |
---|
109 | s.str(""); |
---|
110 | s << pdg; |
---|
111 | values->push_back(G4AttValue("PDG",s.str(),"")); |
---|
112 | |
---|
113 | s.str(""); |
---|
114 | s << eTot; |
---|
115 | values->push_back(G4AttValue("Etot",s.str(),"")); |
---|
116 | |
---|
117 | s.str(""); |
---|
118 | s << edep; |
---|
119 | values->push_back(G4AttValue("Edep",s.str(),"")); |
---|
120 | |
---|
121 | return values; |
---|
122 | }//CreateAttValues |
---|
123 | |
---|
124 | //----------------------------------------------------------------------------------------- |
---|
125 | |
---|
126 | void ELYSE::TrappVolHit::Print() { |
---|
127 | |
---|
128 | G4cout.setf(std::ios::fixed); |
---|
129 | G4cout.precision(2); |
---|
130 | |
---|
131 | G4cout << " -------> Track [" << trkId << "]" |
---|
132 | << " PDG: " << pdg |
---|
133 | << " Parent: " << parentId |
---|
134 | << " Time: " << time |
---|
135 | << " Etot " << eTot |
---|
136 | << " Edep: " << edep |
---|
137 | << " \n Position (" |
---|
138 | << position.x() << " , " |
---|
139 | << position.y() << " , " |
---|
140 | << position.z() << ")\n " |
---|
141 | << G4endl; |
---|
142 | }//Print |
---|
143 | |
---|
144 | |
---|
145 | |
---|