Loading...
Searching...
No Matches
EmCalorimeterHit.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//
27/// \file B5/src/EmCalorimeterHit.cc
28/// \brief Implementation of the B5::EmCalorimeterHit class
29
30#include "EmCalorimeterHit.hh"
31
32#include "G4VVisManager.hh"
33#include "G4VisAttributes.hh"
34#include "G4Colour.hh"
35#include "G4AttDefStore.hh"
36#include "G4AttDef.hh"
37#include "G4AttValue.hh"
38#include "G4UIcommand.hh"
39#include "G4UnitsTable.hh"
40#include "G4SystemOfUnits.hh"
41#include "G4ios.hh"
42
43namespace B5
44{
45
46//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47
49
50//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51
53: fCellID(cellID)
54{}
55
56//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57
59{
60 return (fCellID==right.fCellID);
61}
62
63//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64
66{
67 auto visManager = G4VVisManager::GetConcreteInstance();
68 if ( ! visManager || (fEdep==0.) ) return;
69
70 // Draw a calorimeter cell with a color corresponding to its energy deposit
71 G4Transform3D trans(fRot.inverse(),fPos);
72 G4VisAttributes attribs;
73 auto pVA = fPLogV->GetVisAttributes();
74 if (pVA) attribs = *pVA;
75 auto rcol = fEdep/(0.7*GeV);
76 if (rcol>1.) rcol = 1.;
77 if (rcol<0.4) rcol = 0.4;
78 G4Colour colour(rcol,0.,0.);
79 attribs.SetColour(colour);
80 attribs.SetForceSolid(true);
81 visManager->Draw(*fPLogV,attribs,trans);
82}
83
84//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85
86const std::map<G4String,G4AttDef>* EmCalorimeterHit::GetAttDefs() const
87{
88 G4bool isNew;
89 auto store = G4AttDefStore::GetInstance("EmCalorimeterHit",isNew);
90
91 if (isNew) {
92 (*store)["HitType"]
93 = G4AttDef("HitType","Hit Type","Physics","","G4String");
94
95 (*store)["ID"]
96 = G4AttDef("ID","ID","Physics","","G4int");
97
98 (*store)["Energy"]
99 = G4AttDef("Energy", "Energy Deposited", "Physics", "G4BestUnit",
100 "G4double");
101
102 (*store)["Pos"]
103 = G4AttDef("Pos", "Position", "Physics","G4BestUnit",
104 "G4ThreeVector");
105
106 (*store)["LVol"]
107 = G4AttDef("LVol","Logical Volume","Physics","","G4String");
108 }
109 return store;
110}
111
112//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113
114std::vector<G4AttValue>* EmCalorimeterHit::CreateAttValues() const
115{
116 auto values = new std::vector<G4AttValue>;
117
118 values
119 ->push_back(G4AttValue("HitType","EmCalorimeterHit",""));
120 values
121 ->push_back(G4AttValue("ID",G4UIcommand::ConvertToString(fCellID),""));
122 values
123 ->push_back(G4AttValue("Energy",G4BestUnit(fEdep,"Energy"),""));
124 values
125 ->push_back(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
126
127 if (fPLogV)
128 values->push_back(G4AttValue("LVol",fPLogV->GetName(),""));
129 else
130 values->push_back(G4AttValue("LVol"," ",""));
131
132 return values;
133}
134
135//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
136
138{
139 G4cout << " Cell[" << fCellID << "] " << fEdep/MeV << " (MeV)" << G4endl;
140}
141
142//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
143
144}
Definition of the B5::EmCalorimeterHit class.
EM Calorimeter hit.
const G4LogicalVolume * fPLogV
G4bool operator==(const EmCalorimeterHit &right) const
std::vector< G4AttValue > * CreateAttValues() const override
G4RotationMatrix fRot
const std::map< G4String, G4AttDef > * GetAttDefs() const override
EmCalorimeterHit()=default
G4ThreadLocal G4Allocator< EmCalorimeterHit > * EmCalorimeterHitAllocator

Applications | User Support | Publications | Collaboration