Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
B5EmCalorimeterHit.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: B5EmCalorimeterHit.cc 76474 2013-11-11 10:36:34Z gcosmo $
27 //
28 /// \file B5EmCalorimeterHit.cc
29 /// \brief Implementation of the B5EmCalorimeterHit class
30 
31 #include "B5EmCalorimeterHit.hh"
32 
33 #include "G4VVisManager.hh"
34 #include "G4VisAttributes.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(), fCellID(-1), fEdep(0.), fPos(0), fPLogV(0)
52 {}
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
57 : G4VHit(), fCellID(z), fEdep(0.), fPos(0), fPLogV(0)
58 {}
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61 
63 {}
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66 
68 : G4VHit() {
69  fCellID = right.fCellID;
70  fEdep = right.fEdep;
71  fPos = right.fPos;
72  fRot = right.fRot;
73  fPLogV = right.fPLogV;
74 }
75 
76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77 
79  &right)
80 {
81  fCellID = right.fCellID;
82  fEdep = right.fEdep;
83  fPos = right.fPos;
84  fRot = right.fRot;
85  fPLogV = right.fPLogV;
86  return *this;
87 }
88 
89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
90 
92 {
93  return (fCellID==right.fCellID);
94 }
95 
96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
97 
99 {
101  if (pVVisManager&&(fEdep>0.))
102  {
103  // Draw a calorimeter cell with a color corresponding to its energy deposit
104  G4Transform3D trans(fRot.inverse(),fPos);
105  G4VisAttributes attribs;
106  const G4VisAttributes* pVA = fPLogV->GetVisAttributes();
107  if (pVA) attribs = *pVA;
108  G4double rcol = fEdep/(0.7*GeV);
109  if (rcol>1.) rcol = 1.;
110  if (rcol<0.4) rcol = 0.4;
111  G4Colour colour(rcol,0.,0.);
112  attribs.SetColour(colour);
113  attribs.SetForceSolid(true);
114  pVVisManager->Draw(*fPLogV,attribs,trans);
115  }
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119 
120 const std::map<G4String,G4AttDef>* B5EmCalorimeterHit::GetAttDefs() const
121 {
122  G4bool isNew;
123  std::map<G4String,G4AttDef>* store
124  = G4AttDefStore::GetInstance("B5EmCalorimeterHit",isNew);
125 
126  if (isNew) {
127  (*store)["HitType"]
128  = G4AttDef("HitType","Hit Type","Physics","","G4String");
129 
130  (*store)["ID"]
131  = G4AttDef("ID","ID","Physics","","G4int");
132 
133  (*store)["Energy"]
134  = G4AttDef("Energy", "Energy Deposited", "Physics", "G4BestUnit",
135  "G4double");
136 
137  (*store)["Pos"]
138  = G4AttDef("Pos", "Position", "Physics","G4BestUnit",
139  "G4ThreeVector");
140 
141  (*store)["LVol"]
142  = G4AttDef("LVol","Logical Volume","Physics","","G4String");
143  }
144  return store;
145 }
146 
147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
148 
149 std::vector<G4AttValue>* B5EmCalorimeterHit::CreateAttValues() const
150 {
151  std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
152 
153  values
154  ->push_back(G4AttValue("HitType","EmCalorimeterHit",""));
155  values
156  ->push_back(G4AttValue("ID",G4UIcommand::ConvertToString(fCellID),""));
157  values
158  ->push_back(G4AttValue("Energy",G4BestUnit(fEdep,"Energy"),""));
159  values
160  ->push_back(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
161 
162  if (fPLogV)
163  values->push_back(G4AttValue("LVol",fPLogV->GetName(),""));
164  else
165  values->push_back(G4AttValue("LVol"," ",""));
166 
167  return values;
168 }
169 
170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
171 
173 {
174  G4cout << " Cell[" << fCellID << "] " << fEdep/MeV << " (MeV)" << G4endl;
175 }
176 
177 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
virtual void Draw(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
G4String GetName() const
static G4VVisManager * GetConcreteInstance()
G4double z
Definition: TRTMaterials.hh:39
virtual std::vector< G4AttValue > * CreateAttValues() const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:357
const B5EmCalorimeterHit & operator=(const B5EmCalorimeterHit &right)
Definition: G4VHit.hh:48
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
#define G4ThreadLocal
Definition: tls.hh:52
int G4int
Definition: G4Types.hh:78
int operator==(const B5EmCalorimeterHit &right) const
HepRotation inverse() const
Definition of the B5EmCalorimeterHit class.
G4GLOB_DLL std::ostream G4cout
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
bool G4bool
Definition: G4Types.hh:79
const G4VisAttributes * GetVisAttributes() const
G4ThreadLocal G4Allocator< B5EmCalorimeterHit > * B5EmCalorimeterHitAllocator
#define G4endl
Definition: G4ios.hh:61
std::map< G4String, G4AttDef > * GetInstance(const G4String &storeKey, G4bool &isNew)
double G4double
Definition: G4Types.hh:76