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