Uh oh!
There was an error while loading. Please reload this page.
[WIP] TPC QC: adds occupancy histogram in Cluster task - #2124
Conversation
| if (!mIsMergeable) { | ||
| mQCClusters.getClusters().normalize(); | ||
| mQCClusters.getClusters().normalize(grpECS->getNHBFPerTF()); |
There was a problem hiding this comment.
Not needed, nHBF is already set above.
| mQCClusters.getClusters().normalize(grpECS->getNHBFPerTF()); | |
| mQCClusters.getClusters().normalize(); |
| void finalize(quality_control::postprocessing::Trigger, framework::ServiceRegistryRef) override; | ||
| template <class T> | ||
| void makeRadialProfile(o2::tpc::CalDet<T>& calDet, TCanvas* canv, int nbinsY, float yMin, float yMax); |
There was a problem hiding this comment.
Most probably these functions will never be called outside this code. So the can be in the private part of the class.
Also, the binning is not needed here, since it is only taken from mRanges via the calDet name. Also, the object should not be modified, so it can be `const.
| voidmakeRadialProfile(o2::tpc::CalDet<T>&calDet, TCanvas*canv, intnbinsY, floatyMin, floatyMax); | |
| voidmakeRadialProfile(consto2::tpc::CalDet<T>&calDet, TCanvas*canv); |
| calDet = clusters.getOccupancy(); | ||
| vecPtr = toVector(mCalDetCanvasVec.at(calDetIter)); | ||
| o2::tpc::painter::makeSummaryCanvases(calDet, int(mRanges[calDet.getName()].at(0)), mRanges[calDet.getName()].at(1), mRanges[calDet.getName()].at(2), false, &vecPtr); | ||
| calDetIter++; | ||
| vecPtr = toVector(mCalDetCanvasVec.at(calDetIter)); | ||
| makeRadialProfile(calDet, vecPtr.at(0), int(mRanges[calDet.getName()].at(0)), mRanges[calDet.getName()].at(1), mRanges[calDet.getName()].at(2)); | ||
| calDetIter++; |
There was a problem hiding this comment.
Here is a problem in the logic, since calDet is a reference to the NClusters cal det. So all subsequent assignments will overwrite the NClusters calDet. Also, there is a lot of unnecessary repetitive code here. I propose to add a simple lambda and replace everything below
auto& clusters = clusterData->getClusters();with
auto fillCanvases = [&calDetIter, this](const CalDet& calDet) {
auto vecPtr = toVector(mCalDetCanvasVec.at(calDetIter++));
constauto& ranges = mRanges[calDet.getName()];
o2::tpc::painter::makeSummaryCanvases(calDet, int(ranges.at(0)), ranges.at(1), ranges.at(2), false, &vecPtr);
};
fillCanvases(clusters.getNClusters());
fillCanvases(clusters.getQMax());
if (mIsClusters) {
fillCanvases(clusters.getQTot());
fillCanvases(clusters.getSigmaPad());
fillCanvases(clusters.getSigmaTime());
}
fillCanvases(clusters.getTimeBin());
fillCanvases(clusters.getOccupancy());
makeRadialProfile(calDet, mCalDetCanvasVec.at(calDetIter++).at(0).get());This should be much more compact and easier to read.
| void ClusterVisualizer::makeRadialProfile(o2::tpc::CalDet<T>& calDet, TCanvas* canv, int nbinsY, float yMin, float yMax) | ||
| { | ||
| const std::string_view calName = calDet.getName(); |
There was a problem hiding this comment.
| voidClusterVisualizer::makeRadialProfile(o2::tpc::CalDet<T>& calDet, TCanvas* canv, int nbinsY, float yMin, float yMax) | |
| { | |
| const std::string_view calName = calDet.getName(); | |
| voidClusterVisualizer::makeRadialProfile(const o2::tpc::CalDet<T>& calDet, TCanvas* canv) | |
| { | |
| const std::string_view calName = calDet.getName(); | |
| constauto& ranges = mRanges[calName.data()]; | |
| constint nbinsY = int(ranges.at(0)); | |
| constfloat yMin = ranges.at(1); | |
| constfloat yMax = ranges.at(2); |
wiechula
commented
May 16, 2024
@sbhawani , please fix the clang-format |
No description provided.