Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 101036 2016-11-04 09:00:23Z 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(),
53  fId(id), fTime(time), fPos(0.), fPLogV(nullptr)
54 {}
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
59 {}
60 
61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62 
64 : G4VHit(),
65  fId(right.fId),
66  fTime(right.fTime),
67  fPos(right.fPos),
68  fRot(right.fRot),
69  fPLogV(right.fPLogV)
70 {}
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
75 {
76  fId = right.fId;
77  fTime = right.fTime;
78  fPos = right.fPos;
79  fRot = right.fRot;
80  fPLogV = right.fPLogV;
81  return *this;
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
86 int B5HodoscopeHit::operator==(const B5HodoscopeHit &/*right*/) const
87 {
88  return 0;
89 }
90 
91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
92 
94 {
95  auto visManager = G4VVisManager::GetConcreteInstance();
96  if (! visManager) return;
97 
98  G4Transform3D trans(fRot.inverse(),fPos);
99  G4VisAttributes attribs;
100  auto pVA = fPLogV->GetVisAttributes();
101  if (pVA) attribs = *pVA;
102  G4Colour colour(0.,1.,1.);
103  attribs.SetColour(colour);
104  attribs.SetForceSolid(true);
105  visManager->Draw(*fPLogV,attribs,trans);
106 }
107 
108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
109 
110 const std::map<G4String,G4AttDef>* B5HodoscopeHit::GetAttDefs() const
111 {
112  G4bool isNew;
113  auto store = G4AttDefStore::GetInstance("B5HodoscopeHit",isNew);
114 
115  if (isNew) {
116  (*store)["HitType"]
117  = G4AttDef("HitType","Hit Type","Physics","","G4String");
118 
119  (*store)["ID"]
120  = G4AttDef("ID","ID","Physics","","G4int");
121 
122  (*store)["Time"]
123  = G4AttDef("Time","Time","Physics","G4BestUnit","G4double");
124 
125  (*store)["Pos"]
126  = G4AttDef("Pos","Position","Physics","G4BestUnit","G4ThreeVector");
127 
128  (*store)["LVol"]
129  = G4AttDef("LVol","Logical Volume","Physics","","G4String");
130  }
131  return store;
132 }
133 
134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
135 
136 std::vector<G4AttValue>* B5HodoscopeHit::CreateAttValues() const
137 {
138  auto values = new std::vector<G4AttValue>;
139 
140  values
141  ->push_back(G4AttValue("HitType","HodoscopeHit",""));
142  values
143  ->push_back(G4AttValue("ID",G4UIcommand::ConvertToString(fId),""));
144  values
145  ->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),""));
146  values
147  ->push_back(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
148 
149  if (fPLogV)
150  values->push_back(G4AttValue("LVol",fPLogV->GetName(),""));
151  else
152  values->push_back(G4AttValue("LVol"," ",""));
153 
154  return values;
155 }
156 
157 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
158 
160 {
161  G4cout << " Hodoscope[" << fId << "] " << fTime/ns << " (nsec)" << G4endl;
162 }
163 
164 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static G4VVisManager * GetConcreteInstance()
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:372
Definition: G4VHit.hh:48
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
#define G4ThreadLocal
Definition: tls.hh:89
virtual std::vector< G4AttValue > * CreateAttValues() const
int G4int
Definition: G4Types.hh:78
HepRotation inverse() const
B5HodoscopeHit(G4int i, G4double t)
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
const G4VisAttributes * GetVisAttributes() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual ~B5HodoscopeHit()
Definition of the B5HodoscopeHit class.
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)
const G4String & GetName() const
double G4double
Definition: G4Types.hh:76
G4ThreadLocal G4Allocator< B5HodoscopeHit > * B5HodoscopeHitAllocator
#define ns
Definition: xmlparse.cc:614