Skip to content

Commit dacaca1

Browse files
committed
removed hitbit set, storing all vars
1 parent c1b75db commit dacaca1

16 files changed

Lines changed: 133 additions & 367 deletions

gemc/gdynamicDigitization/examples/gplugin_test_example.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
// - This .cc file contains implementation-only comments to avoid duplicated \param sections.
66

77
bool GPlugin_test_example::defineReadoutSpecsImpl() {
8-
double timeWindow = 10; // electronics time-window (width of one time cell)
9-
double gridStartTime = 0; // time grid origin
10-
auto hitBitSet = HitBitSet("100000"); // bitset defining which hit information is computed/stored
8+
double timeWindow = 10; // electronics time-window (width of one time cell)
9+
double gridStartTime = 0; // time grid origin
1110
double maxStep = 1 * CLHEP::mm;
1211

13-
readoutSpecs = std::make_shared<GReadoutSpecs>(timeWindow, gridStartTime, hitBitSet, maxStep, log);
12+
readoutSpecs = std::make_shared<GReadoutSpecs>(timeWindow, gridStartTime, maxStep, log);
1413

1514
return true;
1615
}

gemc/gdynamicDigitization/gDosimeterDigitization.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
bool GDosimeterDigitization::defineReadoutSpecsImpl() {
1616
// Time window is the width of one electronics time cell (unit follows the convention
1717
// used by the rest of the digitization chain; typically ns).
18-
double timeWindow = 10; // electronic readout time-window of the detector
19-
double gridStartTime = 0; // defines the windows grid
20-
auto hitBitSet = HitBitSet("000001"); // defines what information to be stored in the hit
18+
double timeWindow = 10; // electronic readout time-window of the detector
19+
double gridStartTime = 0; // defines the windows grid
2120
double maxStep = 1 * CLHEP::mm;
2221

2322
// Readout specs are immutable after initialization and shared by all processed hits.
24-
readoutSpecs = std::make_shared<GReadoutSpecs>(timeWindow, gridStartTime, hitBitSet, maxStep, log);
23+
readoutSpecs = std::make_shared<GReadoutSpecs>(timeWindow, gridStartTime, maxStep, log);
2524

2625
return true;
2726
}
@@ -42,8 +41,7 @@ std::unique_ptr<GDigitizedData> GDosimeterDigitization::digitizeHitImpl(GHit* gh
4241
//log->info(0, FUNCTION_NAME, "Edep: ", etot, ", hitn:", ghit->getEdeps().size());
4342

4443
// // Per-step information used to build the NIEL-weight.
45-
// auto pids = ghit->getPids();
46-
// auto pEnergies = ghit->getEs();
44+
// auto pids = ghit->getPids();
4745
//
4846
// double nielWeight = 0;
4947
//

gemc/gdynamicDigitization/gFluxDigitization.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
// See header for API docs.
44
bool GFluxDigitization::defineReadoutSpecsImpl() {
5-
double timeWindow = 10; // electronic readout time-window of the detector
6-
double gridStartTime = 0; // defines the window grid
7-
auto hitBitSet = HitBitSet("000001"); // defines what information to be stored in the hit
5+
double timeWindow = 10; // electronic readout time-window of the detector
6+
double gridStartTime = 0; // defines the window grid
87
double maxStep = 1 * CLHEP::mm;
98

10-
readoutSpecs = std::make_shared<GReadoutSpecs>(timeWindow, gridStartTime, hitBitSet, maxStep, log);
9+
readoutSpecs = std::make_shared<GReadoutSpecs>(timeWindow, gridStartTime, maxStep, log);
1110

1211
return true;
1312
}

gemc/gdynamicDigitization/gParticleCounterDigitization.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
// See header for API docs.
44
bool GParticleCounterDigitization::defineReadoutSpecsImpl() {
5-
double timeWindow = 10; // electronic readout time-window of the detector
6-
double gridStartTime = 0; // defines the window grid
7-
auto hitBitSet = HitBitSet("000001"); // defines what information to be stored in the hit
5+
double timeWindow = 10; // electronic readout time-window of the detector
6+
double gridStartTime = 0; // defines the window grid
87
double maxStep = 1 * CLHEP::mm;
98

10-
readoutSpecs = std::make_shared<GReadoutSpecs>(timeWindow, gridStartTime, hitBitSet, maxStep, log);
9+
readoutSpecs = std::make_shared<GReadoutSpecs>(timeWindow, gridStartTime, maxStep, log);
1110

1211
return true;
1312
}

gemc/gdynamicDigitization/gdynamicdigitization.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ std::unique_ptr<GTrueInfoData> GDynamicDigitization::collectTrueInformationImpl(
2626

2727

2828

29-
// Bit 0 is expected to contain the always-present true-hit quantities.
30-
ghit->calculateInfosForBit(0);
29+
ghit->calculateInfos();
3130

3231
// Average positions are computed at the hit level by GHit and returned here.
3332
G4ThreeVector avgGlobalPos = ghit->getAvgGlobaPosition();

gemc/gdynamicDigitization/greadoutSpecs.h

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@
66
*
77
* GReadoutSpecs represents the (simple) electronics timing model needed by digitization:
88
* a time window defines the width of one electronics time bin, and a grid start time
9-
* defines the phase (offset) of that binning. A HitBitSet encodes which hit information
10-
* is computed/stored.
9+
* defines the phase (offset) of that binning.
1110
*
1211
* \note
1312
* This header intentionally does not declare a \c \\mainpage. Module-level documentation
1413
* for gdynamic digitization lives in gdynamicdigitizationDoxy.h.
1514
*/
1615

17-
#include <gemc/ghit/ghitConventions.h> // HitBitSet
1816
#include <gemc/glogging/glogger.h>
1917

2018
#include <cmath>
2119
#include <type_traits>
2220

2321
/**
2422
* \class GReadoutSpecs
25-
* \brief Immutable readout timing and storage specification.
23+
* \brief Immutable readout timing specification.
2624
*
2725
* Instances of this class are typically constructed by digitization plugins inside
2826
* \ref GDynamicDigitization::defineReadoutSpecs "defineReadoutSpecs()" and then shared
@@ -40,11 +38,7 @@ class GReadoutSpecs
4038
/// Time offset (origin) of the electronics time grid.
4139
double gridStartTime;
4240

43-
/// Bitset controlling which hit information is computed/stored.
44-
HitBitSet hitBitSet;
45-
46-
// the corresponding logical volume will its user limits to
47-
// G4UserLimits(maxStep, maxStep));
41+
/// Maximum step length for the associated logical volume.
4842
double maxStep;
4943

5044
public:
@@ -55,30 +49,19 @@ class GReadoutSpecs
5549
*
5650
* \param tw Electronics time window (width of one time cell).
5751
* \param gst Grid start time (time offset for binning).
58-
* \param hbs Hit bitset controlling which hit fields are stored/computed.
59-
* \param ms Max step for the logical volume
52+
* \param ms Max step for the logical volume.
6053
* \param log Logger used for informational output.
6154
*/
6255
GReadoutSpecs(const double tw,
6356
const double gst,
64-
const HitBitSet hbs,
6557
const double ms,
6658
const std::shared_ptr<GLogger>& log) :
6759
timeWindow(tw),
6860
gridStartTime(gst),
69-
hitBitSet(hbs),
7061
maxStep(ms) {
71-
log->info(1, "GReadoutSpecs: timeWindow=", timeWindow, ", gridStartTime=", gridStartTime, ", hitBitSet=",
72-
hitBitSet);
62+
log->info(1, "GReadoutSpecs: timeWindow=", timeWindow, ", gridStartTime=", gridStartTime);
7363
}
7464

75-
/**
76-
* \brief Returns the configured hit bitset.
77-
*
78-
* \return The HitBitSet that defines what hit information is stored.
79-
*/
80-
[[nodiscard]] inline HitBitSet getHitBitSet() const { return hitBitSet; }
81-
8265
[[nodiscard]] inline double getMaxStep() const { return maxStep; }
8366

8467
/**

gemc/ghit/addHitInfos.cc

Lines changed: 9 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,30 @@
99

1010
// See header for API docs.
1111

12-
void GHit::addHitInfosForBitset(const HitBitSet hbs, const G4Step* step) {
13-
// Preconditions:
14-
// - 'step' must be non-null (callers provide a valid G4Step from the stepping action).
15-
// - 'gtouchable' must be valid; it provides energy scaling and identity/dimensions.
16-
12+
void GHit::addHitInfos(const G4Step* step) {
1713
auto preStepPoint = step->GetPreStepPoint();
18-
// auto poststepPoint = step->GetPostStepPoint();
1914

2015
auto touchable = preStepPoint->GetTouchable();
2116

22-
// Get the global position and transform it to local coordinates of the touchable.
17+
// Global position and its local-coordinate transform.
2318
G4ThreeVector xyz = preStepPoint->GetPosition();
2419
G4ThreeVector xyzL = touchable->GetHistory()->GetTopTransform().TransformPoint(xyz);
2520

2621
globalPositions.push_back(xyz);
2722
localPositions.push_back(xyzL);
2823

29-
// Retrieve energy deposition and time information.
30-
// Energy is scaled by the detector-specific multiplier from GTouchable.
24+
// Energy deposition (scaled by detector multiplier) and global time.
3125
double edep = (step->GetTotalEnergyDeposit()) * (gtouchable->getEnergyMultiplier());
3226
double time = preStepPoint->GetGlobalTime();
3327

3428
edeps.push_back(edep);
3529
times.push_back(time);
3630

37-
auto track = step->GetTrack();
38-
auto trackVertex = track->GetVertexPosition();
39-
int trackId = track->GetTrackID();
31+
auto track = step->GetTrack();
32+
auto trackVertex = track->GetVertexPosition();
33+
int trackId = track->GetTrackID();
4034
int motherTrackId = track->GetParentID();
41-
int currentPdg = track->GetDefinition()->GetPDGEncoding();
35+
int currentPdg = track->GetDefinition()->GetPDGEncoding();
4236

4337
trackVertexById.emplace(trackId, trackVertex);
4438
pdgById.emplace(trackId, currentPdg);
@@ -66,39 +60,7 @@ void GHit::addHitInfosForBitset(const HitBitSet hbs, const G4Step* step) {
6660
trackEs.push_back(preStepPoint->GetTotalEnergy());
6761
motherPids.push_back(motherPdg);
6862

69-
70-
// Iterate over each bit and call the helper method to add optional info.
71-
for (size_t hbIndex = 0; hbIndex < hbs.size(); hbIndex++) {
72-
addHitInfosForBitIndex(hbIndex, hbs.test(hbIndex), step);
73-
}
74-
}
75-
76-
bool GHit::addHitInfosForBitIndex(size_t bitIndex, const bool test, const G4Step* thisStep) {
77-
// If the bit is not enabled, do nothing.
78-
if (!test) return false;
79-
80-
G4Track* trk = thisStep->GetTrack();
81-
G4StepPoint* prestep = thisStep->GetPreStepPoint();
82-
83-
// Bit 0: record particle ID, per-step total energy, and creator process name (if available).
84-
if (bitIndex == 0) {
85-
pids.push_back(trk->GetDefinition()->GetPDGEncoding());
86-
Es.push_back(prestep->GetTotalEnergy());
87-
if (trk->GetCreatorProcess()) {
88-
processNames.push_back(trk->GetCreatorProcess()->GetProcessName());
89-
}
90-
}
91-
else if (bitIndex == 1) {
92-
// Placeholder: record step length and track info.
93-
}
94-
else if (bitIndex == 2) {
95-
// Placeholder: record mother particle track information.
96-
}
97-
else if (bitIndex == 3) {
98-
// Placeholder: record meta information.
99-
}
100-
else if (bitIndex == 4) {
101-
// Placeholder: record optical photon-specific information.
63+
if (track->GetCreatorProcess()) {
64+
processNames.push_back(track->GetCreatorProcess()->GetProcessName());
10265
}
103-
return true;
10466
}

0 commit comments

Comments
 (0)