Skip to content
Snippets Groups Projects
Commit 9c8ddb95 authored by Eric Torrence's avatar Eric Torrence
Browse files

Merge branch 'digi_speed_up' into 'master'

Digi speed up

See merge request !332
parents fcd13ffd de6b27d5
No related branches found
No related tags found
1 merge request!332Digi speed up
Pipeline #5058688 passed
......@@ -99,12 +99,24 @@ CaloWaveformDigiAlg::execute(const EventContext& ctx) const {
// Create structure to store pulse for each channel
std::map<Identifier, std::vector<uint16_t>> waveforms = m_digiTool->create_waveform_map(m_ecalID);
// Sum energy for each channel (i.e. identifier)
std::map<unsigned int, float> esum;
for (const auto& hit : *caloHitHandle) {
esum[hit.identify()] += hit.energyLoss();
}
// Loop over time samples
for (const auto& tk : m_timekernel) {
std::map<unsigned int, float> counts;
// Convolve hit energy with evaluated kernel and sum for each hit id (i.e. channel)
for (const auto& hit : *caloHitHandle) {
counts[hit.identify()] += tk * hit.energyLoss();
//for (const auto& hit : *caloHitHandle) {
// counts[hit.identify()] += tk * hit.energyLoss();
//}
// Convolve summed energy with evaluated kernel for each hit id (i.e. channel)
for (const auto& e : esum) {
counts[e.first] = tk * e.second;
}
// Subtract count from basleine and add result to correct waveform vector
......
......@@ -110,35 +110,61 @@ ScintWaveformDigiAlg::execute(const EventContext& ctx) const {
waveforms = m_digiTool->create_waveform_map(m_preshowerID);
}
// Sum energy for each channel (i.e. identifier)
std::map<Identifier, float> esum;
Identifier id;
for (const auto& hit : *scintHitHandle) {
if (first.isTrigger()) {
Identifier plate_id = m_triggerID->plate_id(hit.getIdentifier());
// Need to do something better here, but for now just fill both
id = m_triggerID->pmt_id(plate_id, 0); // ID for PMT 0
esum[id] += hit.energyLoss();
id = m_triggerID->pmt_id(plate_id, 1); // ID for PMT 1
esum[id] += hit.energyLoss();
} else {
// All others have only 1 PMT
// Use detector id (not hit id) throughout
id = hit.getIdentifier();
esum[id] += hit.energyLoss();
}
}
// Loop over time samples
// Should really do sums first, as repeating these in the loop is a waste
for (const auto& tk : m_timekernel) {
std::map<Identifier, float> counts;
// Convolve hit energy with evaluated kernel and sum for each hit id (i.e. channel)
Identifier id;
for (const auto& hit : *scintHitHandle) {
// Special handling for trigger scintillator
if (first.isTrigger()) {
// Hits are created per plate
// Need to split between 2 PMTs
// Identifier from hit is plate ID
Identifier plate_id = m_triggerID->plate_id(hit.getIdentifier());
// Need to do something better here, but for now just fill both
id = m_triggerID->pmt_id(plate_id, 0); // ID for PMT 0
counts[id] += tk * hit.energyLoss();
id = m_triggerID->pmt_id(plate_id, 1); // ID for PMT 1
counts[id] += tk * hit.energyLoss();
} else {
// All others have only 1 PMT
// Use detector id (not hit id) throughout
id = hit.getIdentifier();
counts[id] += tk * hit.energyLoss();
}
// // Convolve hit energy with evaluated kernel and sum for each hit id (i.e. channel)
// Identifier id;
// for (const auto& hit : *scintHitHandle) {
//
// // Special handling for trigger scintillator
// if (first.isTrigger()) {
// // Hits are created per plate
// // Need to split between 2 PMTs
//
// // Identifier from hit is plate ID
// Identifier plate_id = m_triggerID->plate_id(hit.getIdentifier());
//
// // Need to do something better here, but for now just fill both
// id = m_triggerID->pmt_id(plate_id, 0); // ID for PMT 0
// counts[id] += tk * hit.energyLoss();
// id = m_triggerID->pmt_id(plate_id, 1); // ID for PMT 1
// counts[id] += tk * hit.energyLoss();
//
// } else {
// // All others have only 1 PMT
// // Use detector id (not hit id) throughout
// id = hit.getIdentifier();
// counts[id] += tk * hit.energyLoss();
// }
// }
// Convolve summed energy with evaluated kernel for each hit id (i.e. channel)
for (const auto& e : esum) {
// Convert hit id to Identifier and store
id = e.first;
counts[id] = tk * e.second;
}
// Subtract count from basleine and add result to correct waveform vector
......
......@@ -22,7 +22,7 @@ WaveformDigitisationTool::initialize() {
ATH_MSG_INFO( name() << "::initalize()" );
m_nsamples = 600;
m_random = new TRandom3();
m_random = new TRandom3(0);
return StatusCode::SUCCESS;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment