File indexing completed on 2025-01-31 09:22:53
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 #include "HadCalorimeterHit.hh"
0031
0032 #include "G4AttDef.hh"
0033 #include "G4AttDefStore.hh"
0034 #include "G4AttValue.hh"
0035 #include "G4Box.hh"
0036 #include "G4Colour.hh"
0037 #include "G4SystemOfUnits.hh"
0038 #include "G4Transform3D.hh"
0039 #include "G4UIcommand.hh"
0040 #include "G4UnitsTable.hh"
0041 #include "G4VVisManager.hh"
0042 #include "G4VisAttributes.hh"
0043 #include "G4ios.hh"
0044
0045 namespace B5
0046 {
0047
0048
0049
0050 G4ThreadLocal G4Allocator<HadCalorimeterHit>* HadCalorimeterHitAllocator;
0051
0052
0053
0054 HadCalorimeterHit::HadCalorimeterHit(G4int columnID, G4int rowID)
0055 : fColumnID(columnID), fRowID(rowID)
0056 {}
0057
0058
0059
0060 G4bool HadCalorimeterHit::operator==(const HadCalorimeterHit& right) const
0061 {
0062 return (fColumnID == right.fColumnID && fRowID == right.fRowID);
0063 }
0064
0065
0066
0067 void HadCalorimeterHit::Draw()
0068 {
0069 auto visManager = G4VVisManager::GetConcreteInstance();
0070 if (!visManager || (fEdep == 0.)) return;
0071
0072
0073 G4Transform3D trans(fRot.inverse(), fPos);
0074 G4VisAttributes attribs;
0075 attribs.SetColour(G4Colour::Red());
0076 attribs.SetForceSolid(true);
0077 G4Box box("dummy", 15. * cm, 15. * cm, 1. * m * fEdep / (0.1 * GeV));
0078 visManager->Draw(box, attribs, trans);
0079 }
0080
0081
0082
0083 const std::map<G4String, G4AttDef>* HadCalorimeterHit::GetAttDefs() const
0084 {
0085 G4bool isNew;
0086 auto store = G4AttDefStore::GetInstance("HadCalorimeterHit", isNew);
0087
0088 if (isNew) {
0089 (*store)["HitType"] = G4AttDef("HitType", "Hit Type", "Physics", "", "G4String");
0090
0091 (*store)["Column"] = G4AttDef("Column", "Column ID", "Physics", "", "G4int");
0092
0093 (*store)["Row"] = G4AttDef("Row", "Row ID", "Physics", "", "G4int");
0094
0095 (*store)["Energy"] =
0096 G4AttDef("Energy", "Energy Deposited", "Physics", "G4BestUnit", "G4double");
0097
0098 (*store)["Pos"] = G4AttDef("Pos", "Position", "Physics", "G4BestUnit", "G4ThreeVector");
0099 }
0100 return store;
0101 }
0102
0103
0104
0105 std::vector<G4AttValue>* HadCalorimeterHit::CreateAttValues() const
0106 {
0107 auto values = new std::vector<G4AttValue>;
0108
0109 values->push_back(G4AttValue("HitType", "HadCalorimeterHit", ""));
0110 values->push_back(G4AttValue("Column", G4UIcommand::ConvertToString(fColumnID), ""));
0111 values->push_back(G4AttValue("Row", G4UIcommand::ConvertToString(fRowID), ""));
0112 values->push_back(G4AttValue("Energy", G4BestUnit(fEdep, "Energy"), ""));
0113 values->push_back(G4AttValue("Pos", G4BestUnit(fPos, "Length"), ""));
0114
0115 return values;
0116 }
0117
0118
0119
0120 void HadCalorimeterHit::Print()
0121 {
0122 G4cout << " Cell[" << fRowID << ", " << fColumnID << "] " << fEdep / MeV << " (MeV) " << fPos
0123 << G4endl;
0124 }
0125
0126
0127
0128 }