Geant4  10.02.p01
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 76474 2013-11-11 10:36:34Z 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(), fColumnID(-1), fRowID(-1), fEdep(0.), fPos(0)
54 {}
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
59 : G4VHit(), fColumnID(iCol), fRowID(iRow), fEdep(0.), fPos(0)
60 {}
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 
65 {}
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68 
70 : G4VHit() {
71  fColumnID = right.fColumnID;
72  fRowID = right.fRowID;
73  fEdep = right.fEdep;
74  fPos = right.fPos;
75  fRot = right.fRot;
76 }
77 
78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
79 
82 {
83  fColumnID = right.fColumnID;
84  fRowID = right.fRowID;
85  fEdep = right.fEdep;
86  fPos = right.fPos;
87  fRot = right.fRot;
88  return *this;
89 }
90 
91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
92 
94 {
95  return (fColumnID==right.fColumnID&&fRowID==right.fRowID);
96 }
97 
98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
99 
101 {
103  if (pVVisManager&&(fEdep>0.))
104  {
105  // Draw a calorimeter cell with depth propotional to the energy deposition
106  G4Transform3D trans(fRot.inverse(),fPos);
107  G4VisAttributes attribs;
108  G4Colour colour(1.,0.,0.);
109  attribs.SetColour(colour);
110  attribs.SetForceSolid(true);
111  G4Box box("dummy",15.*cm,15.*cm,1.*m*fEdep/(0.1*GeV));
112  pVVisManager->Draw(box,attribs,trans);
113  }
114 }
115 
116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
117 
118 const std::map<G4String,G4AttDef>* B5HadCalorimeterHit::GetAttDefs() const
119 {
120  G4bool isNew;
121  std::map<G4String,G4AttDef>* store
122  = 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  std::vector<G4AttValue>* 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......
virtual void Draw(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
static const double cm
Definition: G4SIunits.hh:118
static const double MeV
Definition: G4SIunits.hh:211
Definition of the B5DetectorConstruction class.
static G4VVisManager * GetConcreteInstance()
Definition: G4Box.hh:64
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
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
G4GLOB_DLL std::ostream G4cout
G4ThreadLocal G4Allocator< B5HadCalorimeterHit > * B5HadCalorimeterHitAllocator
bool G4bool
Definition: G4Types.hh:79
HepGeom::Transform3D G4Transform3D
static const double GeV
Definition: G4SIunits.hh:214
int operator==(const B5HadCalorimeterHit &right) const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
Hadron Calorimeter hit.
#define G4endl
Definition: G4ios.hh:61
static const double m
Definition: G4SIunits.hh:128
std::map< G4String, G4AttDef > * GetInstance(const G4String &storeKey, G4bool &isNew)
const B5HadCalorimeterHit & operator=(const B5HadCalorimeterHit &right)
Definition of the B5HadCalorimeterHit class.