ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
B5HodoscopeHit.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file B5HodoscopeHit.cc
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 //
29 
30 #include "B5HodoscopeHit.hh"
31 
32 #include "G4VVisManager.hh"
33 #include "G4VisAttributes.hh"
34 #include "G4Circle.hh"
35 #include "G4Colour.hh"
36 #include "G4AttDefStore.hh"
37 #include "G4AttDef.hh"
38 #include "G4AttValue.hh"
39 #include "G4UIcommand.hh"
40 #include "G4UnitsTable.hh"
41 #include "G4SystemOfUnits.hh"
42 #include "G4ios.hh"
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45 
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49 
51 : G4VHit(),
52  fId(id), fTime(time), fPos(0.), fPLogV(nullptr)
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 
86 {
87  return false;
88 }
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91 
93 {
94  auto visManager = G4VVisManager::GetConcreteInstance();
95  if (! visManager) return;
96 
97  G4Transform3D trans(fRot.inverse(),fPos);
98  G4VisAttributes attribs;
99  auto pVA = fPLogV->GetVisAttributes();
100  if (pVA) attribs = *pVA;
101  G4Colour colour(0.,1.,1.);
102  attribs.SetColour(colour);
103  attribs.SetForceSolid(true);
104  visManager->Draw(*fPLogV,attribs,trans);
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
108 
109 const std::map<G4String,G4AttDef>* B5HodoscopeHit::GetAttDefs() const
110 {
111  G4bool isNew;
112  auto store = G4AttDefStore::GetInstance("B5HodoscopeHit",isNew);
113 
114  if (isNew) {
115  (*store)["HitType"]
116  = G4AttDef("HitType","Hit Type","Physics","","G4String");
117 
118  (*store)["ID"]
119  = G4AttDef("ID","ID","Physics","","G4int");
120 
121  (*store)["Time"]
122  = G4AttDef("Time","Time","Physics","G4BestUnit","G4double");
123 
124  (*store)["Pos"]
125  = G4AttDef("Pos","Position","Physics","G4BestUnit","G4ThreeVector");
126 
127  (*store)["LVol"]
128  = G4AttDef("LVol","Logical Volume","Physics","","G4String");
129  }
130  return store;
131 }
132 
133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
134 
135 std::vector<G4AttValue>* B5HodoscopeHit::CreateAttValues() const
136 {
137  auto values = new std::vector<G4AttValue>;
138 
139  values
140  ->push_back(G4AttValue("HitType","HodoscopeHit",""));
141  values
142  ->push_back(G4AttValue("ID",G4UIcommand::ConvertToString(fId),""));
143  values
144  ->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),""));
145  values
146  ->push_back(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
147 
148  if (fPLogV)
149  values->push_back(G4AttValue("LVol",fPLogV->GetName(),""));
150  else
151  values->push_back(G4AttValue("LVol"," ",""));
152 
153  return values;
154 }
155 
156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
157 
159 {
160  G4cout << " Hodoscope[" << fId << "] " << fTime/ns << " (nsec)" << G4endl;
161 }
162 
163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......