Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
B5HadCalorimeterHit.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: B5HadCalorimeterHit.cc 101036 2016-11-04 09:00:23Z gcosmo $
27 //
30 
31 #include "B5HadCalorimeterHit.hh"
33 
34 #include "G4VVisManager.hh"
35 #include "G4VisAttributes.hh"
36 #include "G4Box.hh"
37 #include "G4Colour.hh"
38 #include "G4AttDefStore.hh"
39 #include "G4AttDef.hh"
40 #include "G4AttValue.hh"
41 #include "G4UIcommand.hh"
42 #include "G4UnitsTable.hh"
43 #include "G4SystemOfUnits.hh"
44 #include "G4ios.hh"
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
53 : G4VHit(),
54  fColumnID(-1), fRowID(-1), fEdep(0.), fPos(0)
55 {}
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
60 : G4VHit(),
61  fColumnID(columnID), fRowID(rowID), fEdep(0.), fPos(0)
62 {}
63 
64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
65 
67 {}
68 
69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70 
72 : G4VHit(),
73  fColumnID(right.fColumnID),
74  fRowID(right.fRowID),
75  fEdep(right.fEdep),
76  fPos(right.fPos),
77  fRot(right.fRot)
78 {}
79 
80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
81 
84 {
85  fColumnID = right.fColumnID;
86  fRowID = right.fRowID;
87  fEdep = right.fEdep;
88  fPos = right.fPos;
89  fRot = right.fRot;
90  return *this;
91 }
92 
93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94 
96 {
97  return (fColumnID==right.fColumnID&&fRowID==right.fRowID);
98 }
99 
100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101 
103 {
104  auto visManager = G4VVisManager::GetConcreteInstance();
105  if (! visManager || (fEdep==0.)) return;
106 
107  // Draw a calorimeter cell with depth propotional to the energy deposition
108  G4Transform3D trans(fRot.inverse(),fPos);
109  G4VisAttributes attribs;
110  G4Colour colour(1.,0.,0.);
111  attribs.SetColour(colour);
112  attribs.SetForceSolid(true);
113  G4Box box("dummy",15.*cm,15.*cm,1.*m*fEdep/(0.1*GeV));
114  visManager->Draw(box,attribs,trans);
115 }
116 
117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
118 
119 const std::map<G4String,G4AttDef>* B5HadCalorimeterHit::GetAttDefs() const
120 {
121  G4bool isNew;
122  auto store = G4AttDefStore::GetInstance("B5HadCalorimeterHit",isNew);
123 
124  if (isNew) {
125  (*store)["HitType"]
126  = G4AttDef("HitType","Hit Type","Physics","","G4String");
127 
128  (*store)["Column"]
129  = G4AttDef("Column","Column ID","Physics","","G4int");
130 
131  (*store)["Row"]
132  = G4AttDef("Row","Row ID","Physics","","G4int");
133 
134  (*store)["Energy"]
135  = G4AttDef("Energy","Energy Deposited","Physics","G4BestUnit",
136  "G4double");
137 
138  (*store)["Pos"]
139  = G4AttDef("Pos", "Position", "Physics","G4BestUnit",
140  "G4ThreeVector");
141  }
142  return store;
143 }
144 
145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
146 
147 std::vector<G4AttValue>* B5HadCalorimeterHit::CreateAttValues() const
148 {
149  auto values = new std::vector<G4AttValue>;
150 
151  values
152  ->push_back(G4AttValue("HitType","HadCalorimeterHit",""));
153  values
154  ->push_back(G4AttValue("Column",G4UIcommand::ConvertToString(fColumnID),
155  ""));
156  values
157  ->push_back(G4AttValue("Row",G4UIcommand::ConvertToString(fRowID),""));
158  values
159  ->push_back(G4AttValue("Energy",G4BestUnit(fEdep,"Energy"),""));
160  values
161  ->push_back(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
162 
163  return values;
164 }
165 
166 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
167 
169 {
170  G4cout << " Cell[" << fRowID << ", " << fColumnID << "] "
171  << fEdep/MeV << " (MeV) " << fPos << G4endl;
172 }
173 
174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Definition of the B5DetectorConstruction class.
static G4VVisManager * GetConcreteInstance()
Definition: G4Box.hh:64
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 std::vector< G4AttValue > * CreateAttValues() const
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
HepRotation inverse() const
G4GLOB_DLL std::ostream G4cout
static constexpr double m
Definition: G4SIunits.hh:129
bool G4bool
Definition: G4Types.hh:79
G4ThreadLocal G4Allocator< B5HadCalorimeterHit > * B5HadCalorimeterHitAllocator
static constexpr double cm
Definition: G4SIunits.hh:119
int operator==(const B5HadCalorimeterHit &right) const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
static constexpr double GeV
Definition: G4SIunits.hh:217
#define G4endl
Definition: G4ios.hh:61
static constexpr double MeV
Definition: G4SIunits.hh:214
std::map< G4String, G4AttDef > * GetInstance(const G4String &storeKey, G4bool &isNew)
const B5HadCalorimeterHit & operator=(const B5HadCalorimeterHit &right)
Definition of the B5HadCalorimeterHit class.