File indexing completed on 2026-09-11 08:31:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include "RE01CalorimeterHit.hh"
0030
0031 #include "G4AttDef.hh"
0032 #include "G4AttDefStore.hh"
0033 #include "G4AttValue.hh"
0034 #include "G4Colour.hh"
0035 #include "G4LogicalVolume.hh"
0036 #include "G4SystemOfUnits.hh"
0037 #include "G4UIcommand.hh"
0038 #include "G4UnitsTable.hh"
0039 #include "G4VVisManager.hh"
0040 #include "G4VisAttributes.hh"
0041 #include "G4ios.hh"
0042
0043 G4ThreadLocal G4Allocator<RE01CalorimeterHit>* RE01CalorimeterHitAllocator = 0;
0044
0045
0046 RE01CalorimeterHit::RE01CalorimeterHit(G4LogicalVolume* logVol, G4int z, G4int phi)
0047 : G4VHit(),
0048 fZCellID(z),
0049 fPhiCellID(phi),
0050 fEdep(0.0),
0051 fPos(0),
0052 fRot(0., 0., 0.),
0053 fPLogV(logVol),
0054 fEdepByATrack(0.0),
0055 fTrackInfo()
0056 {
0057 ;
0058 }
0059
0060
0061 RE01CalorimeterHit::~RE01CalorimeterHit()
0062 {
0063 ;
0064 }
0065
0066
0067 void RE01CalorimeterHit::Draw()
0068 {
0069 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
0070 if (pVVisManager) {
0071 G4Transform3D trans(fRot, fPos);
0072 G4VisAttributes attribs;
0073 const G4VisAttributes* pVA = fPLogV->GetVisAttributes();
0074 if (pVA) attribs = *pVA;
0075 G4Colour colour(1., 0., 0.);
0076 attribs.SetColour(colour);
0077 attribs.SetForceWireframe(false);
0078 attribs.SetForceSolid(true);
0079 pVVisManager->Draw(*fPLogV, attribs, trans);
0080 }
0081 }
0082
0083
0084 const std::map<G4String, G4AttDef>* RE01CalorimeterHit::GetAttDefs() const
0085 {
0086 G4bool isNew;
0087 std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("RE01CalorimeterHit", isNew);
0088 if (isNew) {
0089 G4String hitType("HitType");
0090 (*store)[hitType] = G4AttDef(hitType, "Hit Type", "Physics", "", "G4String");
0091
0092 G4String zCellID("ZCellID");
0093 (*store)[zCellID] = G4AttDef(zCellID, "Z Cell ID", "Physics", "", "G4int");
0094
0095 G4String phiCellID("PhiCellID");
0096 (*store)[phiCellID] = G4AttDef(phiCellID, "Phi Cell ID", "Physics", "", "G4int");
0097
0098 G4String energy("Energy");
0099 (*store)[energy] = G4AttDef(energy, "Energy Deposited", "Physics", "G4BestUnit", "G4double");
0100
0101 G4String eTrack("ETrack");
0102 (*store)[eTrack] =
0103 G4AttDef(eTrack, "Energy Deposited By Track", "Physics", "G4BestUnit", "G4double");
0104
0105 G4String pos("Pos");
0106 (*store)[pos] = G4AttDef(pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
0107
0108 G4String lvol("LVol");
0109 (*store)[lvol] = G4AttDef(lvol, "Logical Volume", "Physics", "", "G4String");
0110 }
0111
0112 return store;
0113 }
0114
0115
0116 std::vector<G4AttValue>* RE01CalorimeterHit::CreateAttValues() const
0117 {
0118 std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
0119
0120 values->push_back(G4AttValue("HitType", "RE01CalorimeterHit", ""));
0121
0122 values->push_back(G4AttValue("ZCellID", G4UIcommand::ConvertToString(fZCellID), ""));
0123
0124 values->push_back(G4AttValue("PhiCellID", G4UIcommand::ConvertToString(fPhiCellID), ""));
0125
0126 values->push_back(G4AttValue("Energy", G4BestUnit(fEdep, "Energy"), ""));
0127
0128 values->push_back(G4AttValue("ETrack", G4BestUnit(fEdepByATrack, "Energy"), ""));
0129
0130 values->push_back(G4AttValue("Pos", G4BestUnit(fPos, "Length"), ""));
0131
0132 if (fPLogV)
0133 values->push_back(G4AttValue("LVol", fPLogV->GetName(), ""));
0134 else
0135 values->push_back(G4AttValue("LVol", " ", ""));
0136
0137 return values;
0138 }
0139
0140
0141 void RE01CalorimeterHit::Print()
0142 {
0143 G4cout << "Cell[" << fZCellID << "," << fPhiCellID << "] " << fEdep / GeV << " [GeV]"
0144 << G4endl;
0145 }