ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
B5HadCalorimeterHit.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file B5HadCalorimeterHit.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 "B5HadCalorimeterHit.hh"
32 
33 #include "G4VVisManager.hh"
34 #include "G4VisAttributes.hh"
35 #include "G4Box.hh"
36 #include "G4Colour.hh"
37 #include "G4AttDefStore.hh"
38 #include "G4AttDef.hh"
39 #include "G4AttValue.hh"
40 #include "G4UIcommand.hh"
41 #include "G4UnitsTable.hh"
42 #include "G4SystemOfUnits.hh"
43 #include "G4ios.hh"
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50 
52 : G4VHit(),
53  fColumnID(-1), fRowID(-1), fEdep(0.), fPos(0)
54 {}
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
59 : G4VHit(),
60  fColumnID(columnID), fRowID(rowID), fEdep(0.), fPos(0)
61 {}
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64 
66 {}
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69 
71 : G4VHit(),
72  fColumnID(right.fColumnID),
73  fRowID(right.fRowID),
74  fEdep(right.fEdep),
75  fPos(right.fPos),
76  fRot(right.fRot)
77 {}
78 
79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80 
83 {
84  fColumnID = right.fColumnID;
85  fRowID = right.fRowID;
86  fEdep = right.fEdep;
87  fPos = right.fPos;
88  fRot = right.fRot;
89  return *this;
90 }
91 
92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
93 
95 {
96  return (fColumnID==right.fColumnID&&fRowID==right.fRowID);
97 }
98 
99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
100 
102 {
103  auto visManager = G4VVisManager::GetConcreteInstance();
104  if (! visManager || (fEdep==0.)) return;
105 
106  // Draw a calorimeter cell with depth propotional to the energy deposition
107  G4Transform3D trans(fRot.inverse(),fPos);
108  G4VisAttributes attribs;
109  G4Colour colour(1.,0.,0.);
110  attribs.SetColour(colour);
111  attribs.SetForceSolid(true);
112  G4Box box("dummy",15.*cm,15.*cm,1.*m*fEdep/(0.1*GeV));
113  visManager->Draw(box,attribs,trans);
114 }
115 
116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
117 
118 const std::map<G4String,G4AttDef>* B5HadCalorimeterHit::GetAttDefs() const
119 {
120  G4bool isNew;
121  auto store = G4AttDefStore::GetInstance("B5HadCalorimeterHit",isNew);
122 
123  if (isNew) {
124  (*store)["HitType"]
125  = G4AttDef("HitType","Hit Type","Physics","","G4String");
126 
127  (*store)["Column"]
128  = G4AttDef("Column","Column ID","Physics","","G4int");
129 
130  (*store)["Row"]
131  = G4AttDef("Row","Row 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  return store;
142 }
143 
144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
145 
146 std::vector<G4AttValue>* B5HadCalorimeterHit::CreateAttValues() const
147 {
148  auto values = new std::vector<G4AttValue>;
149 
150  values
151  ->push_back(G4AttValue("HitType","HadCalorimeterHit",""));
152  values
153  ->push_back(G4AttValue("Column",G4UIcommand::ConvertToString(fColumnID),
154  ""));
155  values
156  ->push_back(G4AttValue("Row",G4UIcommand::ConvertToString(fRowID),""));
157  values
158  ->push_back(G4AttValue("Energy",G4BestUnit(fEdep,"Energy"),""));
159  values
160  ->push_back(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
161 
162  return values;
163 }
164 
165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
166 
168 {
169  G4cout << " Cell[" << fRowID << ", " << fColumnID << "] "
170  << fEdep/MeV << " (MeV) " << fPos << G4endl;
171 }
172 
173 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......