1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // |
---|
26 | // $Id: A01DriftChamberHit.cc,v 1.11 2006/11/14 07:11:18 perl Exp $ |
---|
27 | // -------------------------------------------------------------- |
---|
28 | // |
---|
29 | #include "A01DriftChamberHit.hh" |
---|
30 | #include "G4ios.hh" |
---|
31 | #include "G4VVisManager.hh" |
---|
32 | #include "G4Circle.hh" |
---|
33 | #include "G4Colour.hh" |
---|
34 | #include "G4AttDefStore.hh" |
---|
35 | #include "G4AttDef.hh" |
---|
36 | #include "G4AttValue.hh" |
---|
37 | #include "G4UIcommand.hh" |
---|
38 | #include "G4UnitsTable.hh" |
---|
39 | #include "G4VisAttributes.hh" |
---|
40 | #include "G4LogicalVolume.hh" |
---|
41 | |
---|
42 | G4Allocator<A01DriftChamberHit> A01DriftChamberHitAllocator; |
---|
43 | |
---|
44 | A01DriftChamberHit::A01DriftChamberHit() |
---|
45 | { |
---|
46 | layerID = -1; |
---|
47 | time = 0.; |
---|
48 | } |
---|
49 | |
---|
50 | A01DriftChamberHit::A01DriftChamberHit(G4int z) |
---|
51 | { |
---|
52 | layerID = z; |
---|
53 | time = 0.; |
---|
54 | } |
---|
55 | |
---|
56 | A01DriftChamberHit::~A01DriftChamberHit() |
---|
57 | {;} |
---|
58 | |
---|
59 | A01DriftChamberHit::A01DriftChamberHit(const A01DriftChamberHit &right) |
---|
60 | : G4VHit() { |
---|
61 | layerID = right.layerID; |
---|
62 | worldPos = right.worldPos; |
---|
63 | localPos = right.localPos; |
---|
64 | time = right.time; |
---|
65 | } |
---|
66 | |
---|
67 | const A01DriftChamberHit& A01DriftChamberHit::operator=(const A01DriftChamberHit &right) |
---|
68 | { |
---|
69 | layerID = right.layerID; |
---|
70 | worldPos = right.worldPos; |
---|
71 | localPos = right.localPos; |
---|
72 | time = right.time; |
---|
73 | return *this; |
---|
74 | } |
---|
75 | |
---|
76 | int A01DriftChamberHit::operator==(const A01DriftChamberHit &/*right*/) const |
---|
77 | { |
---|
78 | return 0; |
---|
79 | } |
---|
80 | |
---|
81 | void A01DriftChamberHit::Draw() |
---|
82 | { |
---|
83 | G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance(); |
---|
84 | if(pVVisManager) |
---|
85 | { |
---|
86 | G4Circle circle(worldPos); |
---|
87 | circle.SetScreenSize(2); |
---|
88 | circle.SetFillStyle(G4Circle::filled); |
---|
89 | G4Colour colour(1.,1.,0.); |
---|
90 | G4VisAttributes attribs(colour); |
---|
91 | circle.SetVisAttributes(attribs); |
---|
92 | pVVisManager->Draw(circle); |
---|
93 | } |
---|
94 | } |
---|
95 | |
---|
96 | const std::map<G4String,G4AttDef>* A01DriftChamberHit::GetAttDefs() const |
---|
97 | { |
---|
98 | G4bool isNew; |
---|
99 | std::map<G4String,G4AttDef>* store |
---|
100 | = G4AttDefStore::GetInstance("A01DriftChamberHit",isNew); |
---|
101 | if (isNew) { |
---|
102 | G4String HitType("HitType"); |
---|
103 | (*store)[HitType] = G4AttDef(HitType,"Hit Type","Physics","","G4String"); |
---|
104 | |
---|
105 | G4String ID("ID"); |
---|
106 | (*store)[ID] = G4AttDef(ID,"ID","Physics","","G4int"); |
---|
107 | |
---|
108 | G4String Time("Time"); |
---|
109 | (*store)[Time] = G4AttDef(Time,"Time","Physics","G4BestUnit","G4double"); |
---|
110 | |
---|
111 | G4String Pos("Pos"); |
---|
112 | (*store)[Pos] = G4AttDef(Pos, "Position", |
---|
113 | "Physics","G4BestUnit","G4ThreeVector"); |
---|
114 | } |
---|
115 | return store; |
---|
116 | } |
---|
117 | |
---|
118 | std::vector<G4AttValue>* A01DriftChamberHit::CreateAttValues() const |
---|
119 | { |
---|
120 | std::vector<G4AttValue>* values = new std::vector<G4AttValue>; |
---|
121 | |
---|
122 | values->push_back(G4AttValue("HitType","DriftChamberHit","")); |
---|
123 | |
---|
124 | values->push_back |
---|
125 | (G4AttValue("ID",G4UIcommand::ConvertToString(layerID),"")); |
---|
126 | |
---|
127 | values->push_back |
---|
128 | (G4AttValue("Time",G4BestUnit(time,"Time"),"")); |
---|
129 | |
---|
130 | values->push_back |
---|
131 | (G4AttValue("Pos",G4BestUnit(worldPos,"Length"),"")); |
---|
132 | |
---|
133 | return values; |
---|
134 | } |
---|
135 | |
---|
136 | void A01DriftChamberHit::Print() |
---|
137 | { |
---|
138 | G4cout << " Layer[" << layerID << "] : time " << time/ns |
---|
139 | << " (nsec) --- local (x,y) " << localPos.x() |
---|
140 | << ", " << localPos.y() << G4endl; |
---|
141 | } |
---|
142 | |
---|
143 | |
---|