Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions duneopdet/LowEPDSUtils/AdjOpHitsUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ namespace solar
double Amplitude = 0;
double PE = 0;
double MaxPE = 0;
std::vector<double> PEperOpDet = {};
size_t NOpDets = art::ServiceHandle<geo::Geometry>()->NOpDets();
std::vector<double> PEperOpDet(NOpDets, 0.);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

double FastToTotal = 1;
double X = 0;
double Y = 0;
Expand Down Expand Up @@ -108,7 +109,7 @@ namespace solar
TimeMax = thisTime;
}

PEperOpDet.push_back(thisPE);
PEperOpDet[wireReadout.OpDetFromOpChannel(PDSHit->OpChannel())] += PDSHit->PE();
Idx++;
}

Expand Down Expand Up @@ -613,7 +614,6 @@ namespace solar
return false;
}


void AdjOpHitsUtils::GetOpHitWaveforms(const std::vector<art::Ptr<recob::OpHit>> &OpHitVector, std::vector<art::Ptr<raw::OpDetWaveform>> &OpHitWvfVector, std::vector<bool> &OpHitWvfValid, art::Event const &evt)
{ // Define a function to get the OpHit waveforms that correspond to each OpHit in the input vector
// Get the OpDetWaveform handle
Expand All @@ -622,7 +622,7 @@ namespace solar
auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
if (!opDetWvfHandle.isValid())
{
ProducerUtils::PrintInColor("Invalid OpDetWaveform handle", ProducerUtils::GetColor("red"), "Error");
ProducerUtils::PrintInColor("Invalid OpDetWaveform handle", ProducerUtils::GetColor("red"), "Debug");
for (size_t i = 0; i < OpHitVector.size(); i++)
{
OpHitWvfVector.push_back(art::Ptr<raw::OpDetWaveform>()); // Fill with a null pointer to keep the indices consistent
Expand Down Expand Up @@ -659,13 +659,15 @@ namespace solar
break;
}
}

if (!found)
{
ProducerUtils::PrintInColor("No matching OpDetWaveform found for OpHit channel " + ProducerUtils::str(int(opChannel)), ProducerUtils::GetColor("red"), "Debug");
OpHitWvfVector.push_back(art::Ptr<raw::OpDetWaveform>()); // Fill with a null pointer to keep the indices consistent
OpHitWvfValid.push_back(false);
}
}

return;
}

Expand All @@ -678,7 +680,12 @@ namespace solar
auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
if (!opWvfHandle.isValid())
{
ProducerUtils::PrintInColor("Invalid OpWaveform handle", ProducerUtils::GetColor("red"), "Error");
ProducerUtils::PrintInColor("Invalid OpWaveform handle", ProducerUtils::GetColor("red"), "Debug");
for (size_t i = 0; i < OpHitVector.size(); i++)
{
OpHitWvfVector.push_back(art::Ptr<recob::OpWaveform>()); // Fill with a null pointer to keep the indices consistent
OpHitWvfValid.push_back(false);
}
return;
}

Expand Down Expand Up @@ -766,4 +773,4 @@ namespace solar
}
}
}
} // namespace solar
} // namespace solar