Geant4  10.00.p02
B5HodoscopeHit.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: B5HodoscopeHit.cc 76474 2013-11-11 10:36:34Z gcosmo $
27 //
30 
31 #include "B5HodoscopeHit.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(), fId(i), fTime(t), fPos(0), fPLogV(0)
53 {}
54 
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56 
58 {}
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61 
63 : G4VHit() {
64  fId = right.fId;
65  fTime = right.fTime;
66  fPos = right.fPos;
67  fRot = right.fRot;
68  fPLogV = right.fPLogV;
69 }
70 
71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72 
74 {
75  fId = right.fId;
76  fTime = right.fTime;
77  fPos = right.fPos;
78  fRot = right.fRot;
79  fPLogV = right.fPLogV;
80  return *this;
81 }
82 
83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84 
85 int B5HodoscopeHit::operator==(const B5HodoscopeHit &/*right*/) const
86 {
87  return 0;
88 }
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91 
93 {
95  if (pVVisManager)
96  {
97  G4Transform3D trans(fRot.inverse(),fPos);
98  G4VisAttributes attribs;
99  const G4VisAttributes* pVA = fPLogV->GetVisAttributes();
100  if (pVA) attribs = *pVA;
101  G4Colour colour(0.,1.,1.);
102  attribs.SetColour(colour);
103  attribs.SetForceSolid(true);
104  pVVisManager->Draw(*fPLogV,attribs,trans);
105  }
106 }
107 
108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
109 
110 const std::map<G4String,G4AttDef>* B5HodoscopeHit::GetAttDefs() const
111 {
112  G4bool isNew;
113  std::map<G4String,G4AttDef>* store
114  = G4AttDefStore::GetInstance("B5HodoscopeHit",isNew);
115 
116  if (isNew) {
117  (*store)["HitType"]
118  = G4AttDef("HitType","Hit Type","Physics","","G4String");
119 
120  (*store)["ID"]
121  = G4AttDef("ID","ID","Physics","","G4int");
122 
123  (*store)["Time"]
124  = G4AttDef("Time","Time","Physics","G4BestUnit","G4double");
125 
126  (*store)["Pos"]
127  = G4AttDef("Pos","Position","Physics","G4BestUnit","G4ThreeVector");
128 
129  (*store)["LVol"]
130  = G4AttDef("LVol","Logical Volume","Physics","","G4String");
131  }
132  return store;
133 }
134 
135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
136 
137 std::vector<G4AttValue>* B5HodoscopeHit::CreateAttValues() const
138 {
139  std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
140 
141  values
142  ->push_back(G4AttValue("HitType","HodoscopeHit",""));
143  values
144  ->push_back(G4AttValue("ID",G4UIcommand::ConvertToString(fId),""));
145  values
146  ->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),""));
147  values
148  ->push_back(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
149 
150  if (fPLogV)
151  values->push_back(G4AttValue("LVol",fPLogV->GetName(),""));
152  else
153  values->push_back(G4AttValue("LVol"," ",""));
154 
155  return values;
156 }
157 
158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
159 
161 {
162  G4cout << " Hodoscope[" << fId << "] " << fTime/ns << " (nsec)" << G4endl;
163 }
164 
165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
virtual void Draw(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
G4String GetName() const
static G4VVisManager * GetConcreteInstance()
const G4LogicalVolume * fPLogV
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:357
Definition: G4VHit.hh:48
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
#define G4ThreadLocal
Definition: tls.hh:52
virtual std::vector< G4AttValue > * CreateAttValues() const
int G4int
Definition: G4Types.hh:78
B5HodoscopeHit(G4int i, G4double t)
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
const G4VisAttributes * GetVisAttributes() const
Hodoscope hit.
HepGeom::Transform3D G4Transform3D
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual ~B5HodoscopeHit()
Definition of the B5HodoscopeHit class.
G4ThreeVector fPos
G4ThreadLocal G4Allocator< B5HodoscopeHit > * B5HodoscopeHitAllocator
int operator==(const B5HodoscopeHit &right) const
#define G4endl
Definition: G4ios.hh:61
const B5HodoscopeHit & operator=(const B5HodoscopeHit &right)
std::map< G4String, G4AttDef > * GetInstance(const G4String &storeKey, G4bool &isNew)
double G4double
Definition: G4Types.hh:76
#define ns
Definition: xmlparse.cc:597
G4RotationMatrix fRot