Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTP: update of the check class #2372

Merged
merged 2 commits into from
Jul 25, 2024
Merged

CTP: update of the check class #2372

merged 2 commits into from
Jul 25, 2024

Conversation

lhusova
Copy link
Contributor

@lhusova lhusova commented Jul 16, 2024

Checking the change in nSigma instead of percentage

Copy link
Collaborator

@knopers8 knopers8 left a comment

Choose a reason for hiding this comment

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

Thank you Lucia! I have some suggestions that you could consider.

@@ -57,6 +57,7 @@ class CTPRawDataReaderTask final : public TaskInterface
std::unique_ptr<TH1D> mHistoMTVXBC = nullptr; // histogram of BC positions to check LHC filling scheme
int mRunNumber;
long int mTimestamp;
TString classNames[65];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you sure this number will never change? Could the number of class be extended elsewhere and cause an out-of-bound access in your code?

Since you use 65 elsewhere, why not make it a constant?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, I would recommend using std::string unless you need a ROOT-specific feature (just because standard library is better tested than ROOT) and std::array instead of c-style array (which is also safer to use).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the constant and std::string are implemented

Comment on lines 147 to 149
double val = mHist->GetBinContent(i);
double valPrev = mHistPrev->GetBinContent(i);
double relDiff = (valPrev != 0) ? (val - valPrev) / TMath::Sqrt(val) : 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can val become 0? It may cause a division by zero here.

for (size_t i = 1; i < mHist->GetXaxis()->GetNbins() + 1; i++) { // Check how many inputs/classes changed more than a threshold value
double val = mHist->GetBinContent(i);
double valPrev = mHistPrev->GetBinContent(i);
double relDiff = (valPrev != 0) ? (val - valPrev) / valPrev : 0;
double relDiff = (val != 0) ? (val - valPrev) / (val * TMath::Sqrt(1 / mHistAbs->GetBinContent(3) + 1 / mHistAbs->GetBinContent(i))) : 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I must say I am completely lost why bin 3 is used here in particular. Just to be sure, it's not a typo?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, I hope mHistAbs->GetBinContent(3) is never -1 and mHistAbs->GetBinContent(i) is never 0. Are you sure it should never happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed it is true only for inputs, that we need the bin 3, so I did it in a more general way now.

Copy link
Collaborator

@knopers8 knopers8 left a comment

Choose a reason for hiding this comment

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

thank you

@knopers8 knopers8 enabled auto-merge (squash) July 25, 2024 11:39
@knopers8 knopers8 merged commit f6820b5 into AliceO2Group:master Jul 25, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants