Hello I am looking to calculate the perimeter of a cluster of charges collected at the anode using the PixelHit object. I wanted to traverse a set of surrounding pixels and determine if they are empty or not to move over the boundary and calculate the perimeter. Is it possible to see if a specific pixel has charges collected or not? Will I need to construct a Pixel and check using the getCharge method?
Hi @oobie2142
are you looking for the perimeter only on the level of “how many pixels are in the cluster”? Then you would only have to look if you find any neighboring PixelHit objects.
There is also the possibility to see from where these charges collected at the electrode come, for this you would have to take the DepositedCharge information as well as your PixelHit and traverse the MC truth chain backwards, see Object History | Allpix Squared
Since we had a similar use case recently, we have implemented a (yet unreleased) function for the PixelCharge object that lets us find all PropagatedCharge objects based on a DepositedCharge:
std::vector<const PropagatedCharge*> PixelCharge::find(const DepositedCharge* deposit) const {
// FIXME: This is not very efficient unfortunately
std::vector<const PropagatedCharge*> propagated_charges;
for(const auto& propagated_charge : propagated_charges_) {
const auto* charge = propagated_charge.get();
if(charge != nullptr && charge->getDepositedCharge() == deposit) {
propagated_charges.emplace_back(propagated_charge.get());
}
}
return propagated_charges;
}
You could attempt something similar in your analysis to link the necessary information together.
Best regards,
Simon