gdynamicDigitization
Loading...
Searching...
No Matches
gFluxDigitization.cc
Go to the documentation of this file.
2
13 // Ensure all loggers and options are properly defined.
15
16 // Define the electronic readout time-window for the detector.
17 double timeWindow = 10; // electronic readout time-window of the detector
18 // Define the start time for the time grid.
19 double gridStartTime = 0; // defines the windows grid
20 // Define the hit bitset: "000001" indicates which information to store in the hit.
21 HitBitSet hitBitSet("000001");
22
23 // Create a new GReadoutSpecs object using the provided parameters.
24 // The digi_logger (obtained via set_loggers()) is used for logging.
25 readoutSpecs = std::make_shared<GReadoutSpecs>(timeWindow, gridStartTime, hitBitSet, log);
26
27 return true;
28}
29
43std::unique_ptr<GDigitizedData> GFluxDigitization::digitizeHitImpl(GHit* ghit, size_t hitn) {
44 // Ensure all required loggers and options are set.
46
47 // Retrieve the first identifier from the hit's identity vector.
48 GIdentifier identity = ghit->getGID().front();
49
50 // Create a new GDigitizedData object using the hit and the data_logger.
51 auto gdata = std::make_unique<GDigitizedData>(gopts, ghit);
52
53 // Include digitized variables into the GDigitizedData object:
54 // 1. Use the identifier's name and value.
55 gdata->includeVariable(identity.getName(), identity.getValue());
56 // 2. Include the hit number.
57 gdata->includeVariable("hitn", static_cast<int>(hitn));
58 // 3. Include the total energy deposited.
59 gdata->includeVariable("totEdep", ghit->getTotalEnergyDeposited());
60 // 4. Include the average time of the hit.
61 gdata->includeVariable("time", ghit->getAverageTime());
62 // 5. Include the particle ID.
63 gdata->includeVariable("pid", ghit->getPid());
64 // 6. Include the total energy (from the hit's energy vector).
65 gdata->includeVariable("totalE", ghit->getE());
66
67 return gdata;
68}
std::shared_ptr< GOptions > gopts
Optional pointer to GOptions.
void check_if_log_defined() const
Checks that all required loggers and options are defined.
std::shared_ptr< const GReadoutSpecs > readoutSpecs
After init, we never mutate these:
std::unique_ptr< GDigitizedData > digitizeHitImpl(GHit *ghit, size_t hitn) override
Digitizes a hit for flux detectors.
bool defineReadoutSpecsImpl() override
Defines readout specifications for flux digitization.
Declares internal digitization classes for various detector types.