Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
B5DriftChamberHit.cc
Go to the documentation of this file.
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: B5DriftChamberHit.cc 101036 2016-11-04 09:00:23Z gcosmo $
27 //
30 
31 #include "B5DriftChamberHit.hh"
32 
33 #include "G4VVisManager.hh"
34 #include "G4VisAttributes.hh"
35 #include "G4Circle.hh"
36 #include "G4Colour.hh"
37 #include "G4AttDefStore.hh"
38 #include "G4AttDef.hh"
39 #include "G4AttValue.hh"
40 #include "G4UIcommand.hh"
41 #include "G4UnitsTable.hh"
42 #include "G4SystemOfUnits.hh"
43 #include "G4ios.hh"
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50 
52 : G4VHit(),
53  fLayerID(-1), fTime(0.), fLocalPos(0), fWorldPos(0)
54 {}
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
59 : G4VHit(),
60  fLayerID(layerID), fTime(0.), fLocalPos(0), fWorldPos(0)
61 {}
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64 
66 {}
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69 
71 : G4VHit(),
72  fLayerID(right.fLayerID),
73  fTime(right.fTime),
74  fLocalPos(right.fLocalPos),
75  fWorldPos(right.fWorldPos)
76 {}
77 
78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
79 
81 {
82  fLayerID = right.fLayerID;
83  fTime = right.fTime;
84  fLocalPos = right.fLocalPos;
85  fWorldPos = right.fWorldPos;
86  return *this;
87 }
88 
89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
90 
92 {
93  return 0;
94 }
95 
96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
97 
99 {
100  auto visManager = G4VVisManager::GetConcreteInstance();
101  if (! visManager) return;
102 
103  G4Circle circle(fWorldPos);
104  circle.SetScreenSize(2);
106  G4Colour colour(1.,1.,0.);
107  G4VisAttributes attribs(colour);
108  circle.SetVisAttributes(attribs);
109  visManager->Draw(circle);
110 }
111 
112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113 
114 const std::map<G4String,G4AttDef>* B5DriftChamberHit::GetAttDefs() const
115 {
116  G4bool isNew;
117  auto store = G4AttDefStore::GetInstance("B5DriftChamberHit",isNew);
118 
119  if (isNew) {
120  (*store)["HitType"]
121  = G4AttDef("HitType","Hit Type","Physics","","G4String");
122 
123  (*store)["ID"]
124  = G4AttDef("ID","ID","Physics","","G4int");
125 
126  (*store)["Time"]
127  = G4AttDef("Time","Time","Physics","G4BestUnit","G4double");
128 
129  (*store)["Pos"]
130  = G4AttDef("Pos", "Position", "Physics","G4BestUnit","G4ThreeVector");
131  }
132 
133  return store;
134 }
135 
136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
137 
138 std::vector<G4AttValue>* B5DriftChamberHit::CreateAttValues() const
139 {
140  auto values = new std::vector<G4AttValue>;
141 
142  values
143  ->push_back(G4AttValue("HitType","DriftChamberHit",""));
144  values
145  ->push_back(G4AttValue("ID",G4UIcommand::ConvertToString(fLayerID),""));
146  values
147  ->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),""));
148  values
149  ->push_back(G4AttValue("Pos",G4BestUnit(fWorldPos,"Length"),""));
150 
151  return values;
152 }
153 
154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
155 
157 {
158  G4cout << " Layer[" << fLayerID << "] : time " << fTime/ns
159  << " (nsec) --- local (x,y) " << fLocalPos.x()
160  << ", " << fLocalPos.y() << G4endl;
161 }
162 
163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
virtual void Draw()
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
double x() const
static G4VVisManager * GetConcreteInstance()
void SetFillStyle(FillStyle)
int operator==(const B5DriftChamberHit &right) const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:372
Definition: G4VHit.hh:48
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
virtual ~B5DriftChamberHit()
virtual std::vector< G4AttValue > * CreateAttValues() const
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
virtual void Print()
void SetVisAttributes(const G4VisAttributes *)
Definition: G4Visible.cc:80
const B5DriftChamberHit & operator=(const B5DriftChamberHit &right)
double y() const
#define G4endl
Definition: G4ios.hh:61
std::map< G4String, G4AttDef > * GetInstance(const G4String &storeKey, G4bool &isNew)
G4ThreadLocal G4Allocator< B5DriftChamberHit > * B5DriftChamberHitAllocator
#define ns
Definition: xmlparse.cc:614
Definition of the B5DriftChamberHit class.
void SetScreenSize(G4double)