Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
A01HadCalorimeterHit.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 //
28 //
29 // $Id$
30 // --------------------------------------------------------------
31 //
32 
33 #include "A01HadCalorimeterHit.hh"
35 #include "G4RunManager.hh"
36 #include "G4RotationMatrix.hh"
37 #include "G4Box.hh"
38 #include "G4VVisManager.hh"
39 #include "G4Colour.hh"
40 #include "G4AttDefStore.hh"
41 #include "G4AttDef.hh"
42 #include "G4AttValue.hh"
43 #include "G4UIcommand.hh"
44 #include "G4UnitsTable.hh"
45 #include "G4VisAttributes.hh"
46 #include "G4LogicalVolume.hh"
47 #include "G4SystemOfUnits.hh"
48 #include "G4ios.hh"
49 
51 
53 {
54  fColumnID = -1;
55  fRowID = -1;
56  fEdep = 0.;
57 }
58 
60 {
61  fColumnID = iCol;
62  fRowID = iRow;
63  fEdep = 0.;
64 }
65 
67 {;}
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 
79 {
80  fColumnID = right.fColumnID;
81  fRowID = right.fRowID;
82  fEdep = right.fEdep;
83  fPos = right.fPos;
84  fRot = right.fRot;
85  return *this;
86 }
87 
89 {
90  return (fColumnID==right.fColumnID&&fRowID==right.fRowID);
91 }
92 
94 {
96  if(pVVisManager&&(fEdep>0.))
97  {
98  // Draw a calorimeter cell with depth propotional to the energy deposition
99  G4Transform3D trans(fRot.inverse(),fPos);
100  G4VisAttributes attribs;
101  G4Colour colour(1.,0.,0.);
102  attribs.SetColour(colour);
103  attribs.SetForceSolid(true);
104  G4Box box("dummy",15.*cm,15.*cm,1.*m*fEdep/(0.1*GeV));
105  pVVisManager->Draw(box,attribs,trans);
106  }
107 }
108 
109 const std::map<G4String,G4AttDef>* A01HadCalorimeterHit::GetAttDefs() const
110 {
111  G4bool isNew;
112  std::map<G4String,G4AttDef>* store
113  = G4AttDefStore::GetInstance("A01HadCalorimeterHit",isNew);
114  if (isNew) {
115  G4String HitType("HitType");
116  (*store)[HitType] = G4AttDef(HitType,"Hit Type","Physics","","G4String");
117 
118  G4String Column("Column");
119  (*store)[Column] = G4AttDef(Column,"Column ID","Physics","","G4int");
120 
121  G4String Row("Row");
122  (*store)[Row] = G4AttDef(Row,"Row ID","Physics","","G4int");
123 
124  G4String Energy("Energy");
125  (*store)[Energy] = G4AttDef(Energy,"Energy Deposited","Physics","G4BestUnit","G4double");
126 
127  G4String Pos("Pos");
128  (*store)[Pos] = G4AttDef(Pos, "Position",
129  "Physics","G4BestUnit","G4ThreeVector");
130  }
131  return store;
132 }
133 
134 std::vector<G4AttValue>* A01HadCalorimeterHit::CreateAttValues() const
135 {
136  std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
137 
138  values->push_back(G4AttValue("HitType","HadCalorimeterHit",""));
139 
140  values->push_back
141  (G4AttValue("Column",G4UIcommand::ConvertToString(fColumnID),""));
142 
143  values->push_back
144  (G4AttValue("Row",G4UIcommand::ConvertToString(fRowID),""));
145 
146  values->push_back
147  (G4AttValue("Energy",G4BestUnit(fEdep,"Energy"),""));
148 
149  values->push_back
150  (G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
151 
152  return values;
153 }
154 
156 {
157  G4cout << " Cell[" << fRowID << ", " << fColumnID << "] " << fEdep/MeV << " (MeV) " << fPos << G4endl;
158 }
159 
160