7#include "gutsConventions.h"
10#include "G4VVisManager.hh"
12#include "G4VisAttributes.hh"
13#include "Randomize.hh"
18std::atomic<int> GHit::globalHitCounter{0};
26 const G4Step* thisStep,
27 const string& cScheme) :
37 averageTime = UNINITIALIZEDNUMBERQUANTITY;
38 avgGlobalPosition = G4ThreeVector(UNINITIALIZEDNUMBERQUANTITY, UNINITIALIZEDNUMBERQUANTITY, UNINITIALIZEDNUMBERQUANTITY);
39 avgLocalPosition = G4ThreeVector(UNINITIALIZEDNUMBERQUANTITY, UNINITIALIZEDNUMBERQUANTITY, UNINITIALIZEDNUMBERQUANTITY);
40 processName = UNINITIALIZEDSTRINGQUANTITY;
53 vector<GIdentifier> gids =
getGID();
54 ttid.reserve(gids.size());
55 for (
auto& gid : gids) {
57 ttid.push_back(gid.getValue());
71 auto visManager = G4VVisManager::GetConcreteInstance();
72 if (!visManager)
return;
78 if (globalPositions.empty())
return;
80 G4Circle circle(globalPositions[0]);
81 circle.SetFillStyle(G4Circle::filled);
87 circle.SetScreenDiameter(10);
88 circle.SetVisAttributes(G4VisAttributes(colour_hit));
89 circle.SetFillStyle(G4Circle::filled);
92 circle.SetScreenSize(8);
93 circle.SetVisAttributes(G4VisAttributes(colour_passby));
94 circle.SetFillStyle(G4Circle::hashed);
97 visManager->Draw(circle);
107bool GHit::setColorSchema() {
109 colour_hit = G4Colour(1.0, 0.0, 0.0);
110 colour_passby = G4Colour(0.0, 1.0, 0.0);
119 for (
int i = 0; i <
nsteps + 1; ++i) {
120 globalPositions.emplace_back(G4UniformRand() * 100, G4UniformRand() * 100, G4UniformRand() * 100);
121 localPositions.emplace_back(G4UniformRand() * 10, G4UniformRand() * 10, G4UniformRand() * 10);
122 times.emplace_back(G4UniformRand() * 100);
123 edeps.emplace_back(G4UniformRand() * 10);
124 Es.emplace_back(G4UniformRand() * 10);
126 pids.emplace_back(
static_cast<int>(G4UniformRand() * 1000));
Represents a hit in the detector.
GHit(std::shared_ptr< GTouchable > gt, HitBitSet hbs, const G4Step *thisStep=nullptr, const std::string &cScheme="default")
Constructor for GHit.
void addHitInfosForBitset(HitBitSet hbs, const G4Step *thisStep)
Adds hit information based on a HitBitSet.
std::vector< GIdentifier > getGID() const
Returns the detector element identity.
std::vector< int > getTTID() const
Returns the touchable identity values as integers.
bool is_same_hit(const GHit *hit) const
Compare two ghits.
void randomizeHitForTesting(int nsteps)
void Draw() override
Draws the hit using Geant4 visualization.
double getTotalEnergyDeposited()
Computes the total energy deposited.
std::shared_ptr< GTouchable > getGTouchable() const
Returns a const reference to the shared_ptr managing the GTouchable.
std::bitset< NHITBITS > HitBitSet
G4ThreadLocal G4Allocator< GHit > * GHitAllocator